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

Simple variable question [Load scripts]

Afternoon All,

Simple question, hopefully my code will speak a thousand words here.

I am trying to do BELOW In my load script.

let minSellingGross = MIN([Selling Gross]) ;

Does anyone know why this isn't assigning the variable? I assume because the data hasn't been actually loaded it can't do it yet.

What is best practice whilst trying to hardcode a variable?

Many thanks,

James.

2 Replies
giakoum
Partner - Master II
Partner - Master II

if Selling Gross is a field previously loaded in the script, you should use fieldvalue function to assign its min value to a variable

Not applicable
Author

Seems the way I got it working was:

Testing:

load

          MIN([Selling Gross]) AS MinSellingGross,

          MAX([Selling Gross]) AS MaxSellingGross

Resident Main;

 

let vMinSellingGross = Peek('MinSellingGross');

let vMaxSellingGross = Peek('MaxSellingGross');