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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Table fields and Variables

In the load script, is it possible to use a field in a table after it has been created? Can I use that I field and assign it to a variable using LET?

I think this would be better presented through an example...

trans:

SELECT tr_product,

    tr_invoice,

    tr_date as "cal_date"

FROM transactions;

LET vTDate = cal_date;                 

--- after this some other load stuff follows ---

I hope you get my problem. If there is a solution to this, could you please show me? 

Appreciate your help!

2 Replies
Not applicable
Author

I think you can with the use of the "Peek" function.

For example, in your table, something like:

LET vTDate = Peek('cal_date', 0, 'trans');

Would give you the oldest date of that table. If you want the newest, just switch the 0 parameter to -1.

Hope it helps

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

Did you mean assign the whole field( with all the field values) to a variable? or just a field name?or first or last field value?