Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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
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
giakoum
Honored Contributor II

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

giakoum
Honored Contributor II

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

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.

Community Browser