Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do I use constants in a load script?

I have a load script where I use the same value in multiple places. It is a date in the format YYYYMM so 201408 in the example below.

LOAD text(City) as City,

     text(State) as State

FROM

(txt, codepage is 1252, embedded labels, delimiter is '\t');

What I want to do is to declare a variable called monthDate that is equal to 201408. Then I want to use that variable in place of 201408 throughout my load script. This way I only have to change the date in one place than in many. Is it possible to do this? Ideally it would something like this.

monthDate = 201408

LOAD text(City) as City,

     text(State) as State

FROM

(txt, codepage is 1252, embedded labels, delimiter is '\t');

1 Solution

Accepted Solutions
Gysbert_Wassenaar

SET monthDate = 201408;

LOAD text(City) as City,

     text(State) as State

FROM

(txt, codepage is 1252, embedded labels, delimiter is '\t');


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Gysbert_Wassenaar

SET monthDate = 201408;

LOAD text(City) as City,

     text(State) as State

FROM

(txt, codepage is 1252, embedded labels, delimiter is '\t');


talk is cheap, supply exceeds demand
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Create monthDate as a variable using SET. Then reference it in your script as $(monthDate).

-Rob

SET monthDate = 201408;

LOAD text(City) as City,

    text(State) as State

FROM

(txt, codepage is 1252, embedded labels, delimiter is '\t');

Not applicable
Author

Thanks! I knew there had to be a way, but was unsure of the syntax.