Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
QFanatic
Creator
Creator

Scripting Assistance for Variable

Hi all,

Silly question this one.

Please paste the below code in an empty QlikView file. My Code fails on the 'Match' statement. I need some assistance to get this to work please, and I've tried all options I can think of.

Thank you

 

 

Tbl:
load
chr(40) & concat(Code, ',') & chr(41) as Codelist;
LOAD * INLINE [
Code
28
29
30
];
Let MyVar = FieldVAlue('Codelist',1);
drop table Tbl;


DemoData_1:
LOAD * INLINE [
Student, Code
Peter, 28
Pam, 88
Paul, 30
];

DemoData:
NoConcatenate load
*
Resident
DemoData_1
where match(Code, $(MyVar)) > 0 ; //this is where it fails - I've also tried $(MyVar), with no luck - it runs, but returns nothing

drop table DemoData_1;

exit SCRIPT

 

Labels (1)
1 Solution

Accepted Solutions
maxgro
MVP
MVP

your variable after the first styatement is (28,29,30)

 

maybe with

where Index('$(MyVar)', Code)

https://help.qlik.com/en-US/sense/February2023/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunc...

 

View solution in original post

3 Replies
Or
MVP
MVP

Try '$(MyVar)'

Otherwise, run it in debug mode and see if the variable is assigned correctly in the first place.

maxgro
MVP
MVP

your variable after the first styatement is (28,29,30)

 

maybe with

where Index('$(MyVar)', Code)

https://help.qlik.com/en-US/sense/February2023/Subsystems/Hub/Content/Sense_Hub/Scripting/StringFunc...

 

QFanatic
Creator
Creator
Author

Thank you - this works!