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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
maxcsquared
Contributor II
Contributor II

Having trouble with single quotes in variable creation and match statement

Hello! I am trying to use a variable to define a list that I use later in the load script to narrow down the number of entries in a table. To create this list and use it in a Match function, I am using single quotes around each item using chr(39). Here's what that looks like in my script:

Valid_Keys:
Load
	chr(39) & Concat(Distinct Product_Key, ', ' ) & chr(39) as Valid_Key_List
Resident Positions;

Let vValid_Key_List = Peek('Valid_Key_List', 0, 'Valid_Keys');

And when I reference this variable in the Match function:

AccountFinal:
NoConcatenate
Load *
Resident AccountExpanded
Where Match(Product_Key, $(vValid_Key_List));

Problematically, when I do this, the resulting table is completely empty. When I Trace the variable just to test it out, it comes out as the following:

Where Match(Product_Key, ''Alternatives|Alternative Strategies|Alternative Strategies'', ''Alternatives|Capital Call Structures|Capital Call Structures'', ''Annuities|Fixed Annuities|Fixed Annuity'') 

In the output it's clear that between each value is two single quotes...I'm extremely confused as to what is happening here and would appreciate any help in figuring out how to correctly assign and call this variable.

Thank you!

Labels (2)
1 Reply
chriscammers
Partner Ambassador
Partner Ambassador

Try this

Load
	Concat(Distinct chr(39) & Product_Key & Chr(39), ', ' )  as Valid_Key_List
Resident Positions;