GetFieldSelections() is front end only function and can't be used in the script.
So you would need to create a variable that holds the value (and not the function to retrieve the value).
In QV, we could use triggers and an action to set the value 'Machine11' to a variable.
In QS, I don't think we have these means.
Hm, not sure how to resolve this (I still haven't looked very deep into QS).
Maybe mto has a good advice?
Like this ? - see sample attached app.
You can do this using the new variables interface:
As Stefan pointed out - GetFieldSelections is a client side, object expression - and not meant to be run in the load script.
Please copy .qvf file to your C:\Users\<user profile>\Documents\Qlik\Sense\Apps and refresh Qlik Sense Desktop with F5
Let me know how you do.
Please mark the appropriate replies as CORRECT / HELPFUL so our team and other members know that your question(s) has been answered to your satisfaction.
VSelections.qvf 288.0 K
Firstly thanks for the answers.
Michael what I really need is to use (vSelection) as a filter in an expression like:
But as you say , the GetFieldSelections function can not be used in the script. So, I would need to get a variable with the textual value resulting from (vSelection) .But this is probably not possible.
Thank you again.
Hi Isaac, I guess I would need to know more about what you are trying to do, and the usecase. Because technically we don't work like a SQL query tool. All the data is loaded from the source into the app and then is on the fly filtered using the client interface and selection objects in the app. It seems to me you are trying to limit the data loaded into the app based of of a previous selection. This still may be possible, but I am not sure how - I added a colleague, whom if he has a moment might respond as well.
I will try to expose the use case in question.
From a main table ( Production) , with the following fields :
Codigo_OP ( Orden Produccion )
Machine ( Maquina )
Item ( Pieza)
RealBegin(Fecha Inicio Seleccion)
RealEnd(Fecha Fin Seleccion)
I create another new table ( Production_timeline ) only with machines that have worked within the specified date range , using for this the Reload extension.
( This is necessary because google api I'm using does not allow Measures )
Then the table ( Production_timeline ) is shown in the timeline and chart table.
Well, what the customer really wants is to select date range and machine and make a new reload with those filters and for this I need to know which machine is selecting , but with GetFieldSelections () as you have said is not possible.
I hope I explained , but ask me anything.
Thanks again for all
instead of getfieldselections([Field]) i usually suggest using concat() instead.
Concat( distinct [Field] , ';' ) ...will create a ; delimitted list of [Field] values in the possible current state.
you could use a single quote character as well
chr(39) & Concat( distinct [Field] , chr(39) & ',' & chr(39) ) & chr(39)
... this would create a string like this : 'Canada','USA'