Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
arsenal1983
Creator
Creator

using variable in script

Hi, I'm trying to write a script that will use a variable in where condition in data loading, example below.

I don't know why it does not work, any suggestions?

TAB_1:

LOAD * Inline

[TIMESTAMP, COL_1, COL_2

2018-10-19 00:43:35 , PCF , 12

2018-10-20 07:36:45 , QAW , 31

2018-10-21 22:28:28 , ERT , 25

2018-10-22 03:42:20 , TPQ , 34

2018-10-20 23:23:29 , YWQ , 78

2018-10-21 10:08:33 , PRT , 49

];

MAX_TIMESTAMP_TAB:

LOAD

timestamp(max(TIMESTAMP)) as MAX_TIMESTAMP

Resident

TAB_1;

Drop table TAB_1;

let vMAX_TSP = Peek('MAX_TIMESTAMP', 0 , 'MAX_TIMESTAMP_TAB');

TAB_2:

LOAD * Inline

[TIMESTAMP, COL_1, COL_2

2018-10-21 15:21:13 , PCF , 115

2018-10-20 21:30:01 , QAW , 103

2018-10-19 20:59:20 , ERT , 177

2018-10-22 20:25:56 , TPQ , 90

2018-10-21 08:58:04 , YWQ , 66

2018-10-19 15:29:26 , PRT , 264

2018-10-20 14:32:36 , YWQ , 282

2018-10-21 02:15:54 , PRT , 277

]

Where

TIMESTAMP > $(vMAX_TSP);

1 Solution

Accepted Solutions
Anonymous
Not applicable

try with character '

Where

TIMESTAMP > '$(vMAX_TSP)';

View solution in original post

3 Replies
Anonymous
Not applicable

try with character '

Where

TIMESTAMP > '$(vMAX_TSP)';

arsenal1983
Creator
Creator
Author

It works! thanks.

Frank_Hartmann
Master II
Master II

you can also use this in MAX_TIMESTAMP_TAB:

timestamp#(max(TIMESTAMP)) as MAX_TIMESTAMP