Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
ZuzJsk007
Contributor III
Contributor III

Expression in GetFieldSelections in Data handling

Hi,I have a filter pane like following - user can only select Yes or No based on a value in field Flag_MaxSimID:

if( Flag_MaxSimID = 1, 'Yes','No' )

I would like to use this filter in GetFiledSelection in Data Handling of an Qlik object, something like:

GetFiledSelection ( if( Flag_MaxSimID = 1, 'Yes','No' ) ) = 'Yes'

 I tried above with no luck.. then ..so since the filter is named "New Simulation" I tried:

GetFiledSelection ('[New Simulation]' ) = 'Yes'

But it didn't work either. Any ideas how to set it up please?

Labels (2)
13 Replies
ZuzJsk007
Contributor III
Contributor III
Author

Dear all, thank you very much for helping, I really appreciate it. I totally must be doing something wrong. Attached you can find the qvf of the app.

[New Simualtion] is a filter pane with 2 possibilites to pick 'Yes' and 'No', the formula behind is:

=if( Flag_MaxSimID = 1, 'Yes','No' )

Flag_MaxSimID is a field calculated within the load script to flag a record with the highest/newest ID

In the app, there's also a table available where I tried to add the conditions above into the Add-ons -> Data handling -> Calculation condition. The aim was to hide the table until a "Yes" in [New Simulation] filter pane is filtered.

App and data are simplified but still valid for this issue.

Thanks again for your help.

ArnadoSandoval
Specialist II
Specialist II

Hi @ZuzJsk007 

I read the help page of (click here) GetFieldSelections; it returns the selection made on a field (any field in the data model); you are passing an expression to the function, so it does not know what to do with it.

I looked at your data model, the field "Flag_MaxSimID" is defined  in the table FormsPriceSim, but this table is not associated with any other table in the data model, so whatever selection if done to the field "Flag_MaxSimID" has not effect on the UI.

If you want to select Yes/No on this field, your should create a new field in your load script implementing your condition, something like this:

    if( Flag_MaxSimID = 1, 'Yes','No' ) As Flag_MaxSimID_YN, 

You should do that around lines 11-12 of the load script in the Forms PriceSim section.

If you create a selector on the field Flag_MaxSimID, it works, but visually you are selecting 1 or 0.

I attached your application, as I added a selector on Flag_MaxSimID.

BTW: the field Flag_MaxSimID only contains one value, the value of 1, there is not a single record in its table having a value of zero.

hth

 

 

Arnaldo Sandoval
A journey of a thousand miles begins with a single step.
Kushal_Chawda

@ZuzJsk007  see the attached

 

ZuzJsk007
Contributor III
Contributor III
Author

So it appears, that it really only works when I alter the load script -> load a value which should be directly selected into a new field which then will be used in the filter pane

in my case, it was sufficient to change the Flag value from 1 to 'Yes' -> then use Flag_MaxSimID directly in filter pane with no alteration and then I can use the if(getfieldselections(Flag_MaxSimID)='Yes',1,0) in Data Handling

Left join (FormsPriceSim)
Load
max(SimulationID) as SimulationID,
'Yes' as Flag_MaxSimID
Resident FormsPriceSim;

 

2020-12-16_132905.jpg

2020-12-16_133005.jpg

 

Thanks a lot!