Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
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
Hi @ZuzJsk007
You do not need the single-quotes, just the square-brackets, just like this:
GetFieldSelections([New Selection])
You condition is like this:
If(GetFieldSelections([New Selection])=1, 'Yes', 'No')
Hope this helps,
@ZuzJsk007 Basically, when you select 'Yes', you are making selection on field Flag_MaxSimID because it has condition on that field. So why don't you just try getfieldselections on Flag_MaxSimID like below instead of calculated field?
=if(getfieldselections(Flag_MaxSimID)=1, ....)
Nope, none of the proposed solution work 😕
I even try combinations like
=if( GetFieldSelections(Flag_MaxSimID)=1,1, 0)
=if( GetFieldSelections([New Simulation])='Yes',1, 0)
Hi @ZuzJsk007
If it contains only 2 values - Yes / No or 1/0.. in that case, u can simply try like below
if(Flag_MaxSimID = 1, 1, 0) <-- if user select 1 values, it display 1 otherwise 0.
This works only if any value is selected (if "Yes" is selected I can the object, if "No" is selected, a warning msg is displayed). But it doesn't work when nothing is selected yet (it ignores the data handling and displays the object) 😞
HI @ZuzJsk007
In that case, Try like below
=GetFieldSelections(Flag_MaxSimID ) =1
If not works, then try like below also
If(Getselectedcount(Flag_MaxSimID) =1 and Flag_MaxSimID = 1, 1, 0)
Hope it helps
nope 😕 I even tried combinations like
= if( count({<Flag_MaxSimID={'1'}>}Flag_MaxSimID) = 1,1, 0)
@ZuzJsk007 Looks like you are doing something wrong because so many suggestions and none of them are working. Please share your sample app to look at
Hi @ZuzJsk007
I agree with @Kushal_Chawda, would you explain to us, who is Flag_MaxSimID? Is it a QVD field or a variable you created either within the load script or the UI? Several of the suggestions should work; your original post also described "[New Simulation]", would you elaborate about these two objects? Your description of your problem is not helping us to help you.
hth