Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

condition to assign a variable

Hi togehter,

how can i set a variable (myVar) during the load process of my csv, if the condition (see below) is true ?
Thank you for any help

************************

MyTable:
LOAD Datum,
if(Datum = '07.01.2011', myVar = 'true', Datum) as DatumCheck,
Impressions

FROM
test1.csv (txt, codepage is 1252, embedded labels, delimiter is ';', msq);


*************************

1 Solution

Accepted Solutions
Not applicable
Author

You can try this code after previous code:


Tmp_Table:
LOAD distinct FlgTest as TmpFlgTeste
resident MyTable
where FlgTest = 1;
LET vMyVar = Peek('TmpFlgTeste');


View solution in original post

5 Replies
Not applicable
Author

Hi,

For set a variable, you need the command SET or LET.

I recommend creating a field in the table.

You try this.



MyTable:
LOAD Datum,
if(Datum = '07.01.2011', 1, 0) as FlgTest,
Impressions
FROM
test1.csv (txt, codepage is 1252, embedded labels, delimiter is ';', msq);


Not applicable
Author

Hello Tonial,

thank you for your answer. But how can I now send an email alert with QV without a variable?

Thank you!

Yours sincerely,

Not applicable
Author

Hi together,

otherwise there is no other way to set variables while loading ? I therefore need a variable
because I want to trigger an email if the records contain old values.

Best regards

Not applicable
Author

You can try this code after previous code:


Tmp_Table:
LOAD distinct FlgTest as TmpFlgTeste
resident MyTable
where FlgTest = 1;
LET vMyVar = Peek('TmpFlgTeste');


Not applicable
Author

Hi Mr. tonial.

thats it ! Thank you very much !

Best Regards