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: 
alexis
Partner - Specialist
Partner - Specialist

Assigning the contents of a variable to a table

Hi
I have the following list of values in a table (see PL_Months)
I select one of these value from a filter pane
The selected value is in vSelectedPLMonth (see below)

I want to add this value to table PL_Choices (see below)
Tried everything - any suggestions?
Thanks

PLMonths:
LOAD * INLINE [
PL_Month
'Oct 2019'

'Nov 2019'
'Dec 2019'
];

SET vSelectedPLMonth = GetFieldSelections([PL_Month]);

PL_Choices:
LOAD * INLINE [
PL_Choice
MTD
YTD
'$(=vSelectedPLMonth)'
];

3 Replies
dwforest
Specialist II
Specialist II

At load time GetFieldSelections would be null

To use the value of a variable in a table, syntax would be $(vSelectedPLMonth)

I think you may want the forumula?

There would be no need to put this in the load script, in your UI, you could simply use GetFieldSelections([PL_Month]) as the dimension value 

alexis
Partner - Specialist
Partner - Specialist
Author

Thanks for replying

The second table should contain 3 values: YTD, MTD and the month selected - I don't think your suggestion achieves that as it needs to allow for the month selected to vary..

Thanks

Alexis

dwforest
Specialist II
Specialist II

So you need to evaluate the selection and add to a list at run time vs load time.

I worked a "solution" if I am understanding the need.

Ditch the formula in the load:

PLMonths:
LOAD * INLINE [
PL_Month
'Oct 2019'
'Nov 2019'
'Dec 2019'
];

//Add a 'place holder' CM for current month selected
PL_Choices:
LOAD * INLINE [
PL_Choice
MTD
YTD
CM
];

In the UI, where you need the values use:

=if(PL_Choice='CM',GetFieldSelections([PL_Month]),PL_Choice)