can i use derived variable in custom code?
Signup/Login with your account
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, in Lumenore Self Service, you can use a derived variable in Custom Code, but only if:
1. Create the Derived Variable
You can create it at two levels:
Option A: Schema Level (Recommended)
Steps:
Example:
Option B: Dashboard Level
2. Add Derived Variable to Query (IMPORTANT)
This is the step most people miss.
Steps:
Profit_Marginand other columns if needed3. Access It in Custom Code
data.datapool.metaDatadata.datapool.resultSetExample Structure:
queryInfo: {…},
metaData: […],
resultSet: [
[12000, “Furniture”, 35]
]
}
Access Using Index (Basic Way)
r.forEach(row => {
let sales = row[0];
let category = row[1];
let profitMargin = row[2];
console.log(“Profit Margin:”, profitMargin);
});
4. Use Metadata
Avoid hardcoding index — use
metaData.col => col.columnName === “Profit_Margin”
);
data.datapool.resultSet.forEach(row => {
console.log(row[index]);
});