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

Set Analysis combined with getfieldselections

Hi all,

I am trying to create an expression that contains set analysis and combines it with getfieldselections() function.

I have tried :

sum({<TransactionDay={'=$(=(GetFieldSelections(SnapshotDay)))'}>}movement_quantity)

sum({<TransactionDay={'=$(#GetFieldSelections(SnapshotDay))'}>}movement_quantity)

as well as others. I am trying to implement that instead of a trigger in a field to correlate selections.

Is that possible??

Regards,

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

But my preference is to use P():
sum({<TransactionDay=P(SnapshotDay)>} movement_quantity)

It works even if no selections made, and no need to additional parameters.

View solution in original post

9 Replies
giakoum
Partner - Master II
Partner - Master II

Nikos, try putting the getfieldselections function into a variable

Not applicable
Author

Hi Gianni,

I have tried

set vSyncTransactSnapshot=GetFieldSelections(SnapshotDay);

sum({<TransactionDay={'=$(#vSyncTransactSnapshot)'}>}movement_quantity)

this as well but it does not seem to work properly.

Regards

giakoum
Partner - Master II
Partner - Master II

try without the # :

sum({<TransactionDay={'=$(=vSyncTransactSnapshot)'}>}movement_quantity)


or


sum({<TransactionDay={'=$(vSyncTransactSnapshot)'}>}movement_quantity)

Not applicable
Author

Hi Giannis,

No luck yet.

I think I am going to try the trigger field selection

Regards

jerem1234
Specialist II
Specialist II

Try the concat function instead:

=sum({<TransactionDay={$(=concat(distinct chr(39) & SnapshotDay & chr(39), ','))}>}movement_quantity)

This has the added advantage where you don't have to specify the number of elements at which GetFieldSelections changes to a format like '12 out of 54'.

If you insist on GetFieldSelections or need it to get specifically the values selected, use:

=sum({<TransactionDay={'$(=GetFieldSelections(SnapshotDay,chr(39) &',' & chr(39), 100))'}>}movement_quantity)

where 100 is just a large number to prevent it to from changing the string to above or "NOT ...".

Hope this helps!

Anonymous
Not applicable
Author

Anonymous
Not applicable
Author

But my preference is to use P():
sum({<TransactionDay=P(SnapshotDay)>} movement_quantity)

It works even if no selections made, and no need to additional parameters.

Not applicable
Author

That is a superb solution jerem1234.

Thank you very much.

Not applicable
Author

Thanks for the help Michael your solution is way more elegant, thus I will mark this one as correct.