Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Announcement: We have made updates to resolve a Page Not Found error. If you still get this error, please let us know in the Community Corner.
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
Highlighted
mov
Esteemed Contributor III

Re: Set Analysis combined with getfieldselections

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.

9 Replies
Partner
Partner

Re: Set Analysis combined with getfieldselections

Nikos, try putting the getfieldselections function into a variable

Not applicable

Re: Set Analysis combined with getfieldselections

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

Partner
Partner

Re: Set Analysis combined with getfieldselections

try without the # :

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


or


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

Not applicable

Re: Set Analysis combined with getfieldselections

Hi Giannis,

No luck yet.

I think I am going to try the trigger field selection

Regards

jerem1234
Valued Contributor II

Re: Set Analysis combined with getfieldselections

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!

mov
Esteemed Contributor III

Re: Set Analysis combined with getfieldselections

Highlighted
mov
Esteemed Contributor III

Re: Set Analysis combined with getfieldselections

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

Re: Set Analysis combined with getfieldselections

That is a superb solution jerem1234.

Thank you very much.

Not applicable

Re: Set Analysis combined with getfieldselections

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