Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is is possible to form an expression dynamically in script? For example, I would like to have a sum function, where columns to sum are based on user input.
In the script, I defined a variable to form the full expression:
Set vSumFieldSelections = 'Sum([' & GetFieldSelections([fieldName],']+[') & '])';
Then my expression in one of the QlikView text object:
=$(vSumFieldSelections)
Thanks
Hi,
PFA
Hope it helps.
As per my knowledge, in the script level its not possible to get the sum of certain values based on the user selection but you can achieve it in the front get .
May be this, set the Expression to the variable then you can use it.
like
set v1='Sum(IDcount)';
set v2='Sum(Aggr(Sum(IDcount), DimA,DimB))';
Set vSumFieldSelections = '=Sum({<DimA=P()>}[DimA])';
LOAD * INLINE [
ID, DimA, DimB, IDcount
2810, 23, 1849, 1
2851, 24, 1849, 1
4098, 28, 2710, 1
5890, 30, 3891, 1
];
PFA for reference.
Hope this helps.