Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamic expression generated by string concatenation based on user input

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

3 Replies
Not applicable
Author

Hi,

PFA

Hope it helps.

avinashelite

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 .

settu_periasamy
Master III
Master III

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.