Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
I need to make a a visualization with each line a new expression. That list of expressions need to be easily expanded and can potentially be big. That means we don't want a developer to change the object every time a new expression is needed.
I was thinking of storing expressions in a data island but I don't want to see the expression, I want to see the value of the expressions.
This is the view of the data island but I can't get the expressions to work.
So is this a good way to work?
If yes, do you know how to make this table to work?
Data I've used
data:
LOAD *
Inline [
client, product, amount, ic
a, product1, 540, 1
a, product1, 87, 0
a, product2, 987, 1
b, product1, 321, 1
c, product2, 456, 1
d, product3, 357, 1
e, product4, 195, 0
];
Expressions:
LOAD *
Inline [
ExpressionName, ExpressionNo, Expression, indent
Total, 7, sum(amount), 0
Total_0, 8, sum( {<ic = {'0'}>} amount), 1
Total_1, 9, sum( {<ic = {'1'}>} amount), 1
Product1, 10, sum( {<product = {'product1'}>} amount), 0
Product1_0, 11, 'sum( {<product = {'product1'}, ic = {'0'}>} amount)', 1
Product1_1, 12, 'sum( {<product = {'product1'}, ic = {'1'}>} amount)', 1
];
That's the easiest way i found:
data:
LOAD *
Inline [
client, product, amount, ic
a, product1, 540, 1
a, product1, 87, 0
a, product2, 987, 1
b, product1, 321, 1
c, product2, 456, 1
d, product3, 357, 1
e, product4, 195, 0
];
Expressions:
LOAD *,
RecNo() as SortOrder
Inline [
ExpressionName, ExpressionNo, Expression, indent
Total, 7, sum(amount), 0
Total_0, 8, sum( {<ic = {'0'}>} amount), 1
Total_1, 9, sum( {<ic = {'1'}>} amount), 1
Product1, 10, sum( {<product = {'product1'}>} amount), 0
Product1_0, 11, 'sum( {<product = {'product1'}, ic = {'0'}>} amount)', 1
Product1_1, 12, 'sum( {<product = {'product1'}, ic = {'1'}>} amount)', 1
];
ExpressionsTemp:
Load
Concat(Expression,',',SortOrder) as [Concat Expression]
Resident Expressions Group By 1;
let vMeasure=peek('Concat Expression',0,'ExpressionsTemp');
Drop Table ExpressionsTemp;
Then setup your table with following expression:
Pick(SortOrder,$(vMeasure))
And the result will be:
Attached you can find the QVF
That's the easiest way i found:
data:
LOAD *
Inline [
client, product, amount, ic
a, product1, 540, 1
a, product1, 87, 0
a, product2, 987, 1
b, product1, 321, 1
c, product2, 456, 1
d, product3, 357, 1
e, product4, 195, 0
];
Expressions:
LOAD *,
RecNo() as SortOrder
Inline [
ExpressionName, ExpressionNo, Expression, indent
Total, 7, sum(amount), 0
Total_0, 8, sum( {<ic = {'0'}>} amount), 1
Total_1, 9, sum( {<ic = {'1'}>} amount), 1
Product1, 10, sum( {<product = {'product1'}>} amount), 0
Product1_0, 11, 'sum( {<product = {'product1'}, ic = {'0'}>} amount)', 1
Product1_1, 12, 'sum( {<product = {'product1'}, ic = {'1'}>} amount)', 1
];
ExpressionsTemp:
Load
Concat(Expression,',',SortOrder) as [Concat Expression]
Resident Expressions Group By 1;
let vMeasure=peek('Concat Expression',0,'ExpressionsTemp');
Drop Table ExpressionsTemp;
Then setup your table with following expression:
Pick(SortOrder,$(vMeasure))
And the result will be:
Attached you can find the QVF