Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I try to get a Load with a where condition like
LOAD
field1,
field2
Fractile(field3,0.95) as field3_95
Resident
LP_Transactions
where
field1 = $(LastRun)
group by field1,field2;
LastNum can be drawn earlier in the script from
LOAD Distinct
runNum
Resident
LP_Runs;
I try to get it into a variable like this:
Let LastRun = max(runNum);
But I never get "LastRun" filled.
In my dashboard I easily can get the correct number. into a text field.
Any suggestions?
tx Frank
Try this for the "earlier in script" part:
tempMaxRun:
LOAD Distinct
Max(runNum) as MaxRunNum
Resident
LP_Runs;
I try to get it into a variable like this:
Let LastRun = Peek('MaxRunNum');
Drop Table tempMaxRun;
The idea why your attempt fails and John's suggestion will work, is that in a load script, aggregation functions on fields can only be used inside a LOAD/SELECT statement. It's not that the aggregation functions won't work (they don't complain), it's that the fields themselves present a problem.
In the load script fields only exist within the context of a LOAD/SELECT statement. Even a Peek('FieldName') will actually peek in the column with that name in a specific table (or the last one you loaded), not in a field.
Try this
T:LOAD Distinct
runNum
Resident
LP_Runs;
W: load max(runNUM) as MAX_NUM
resident T;
Let vMax = peek('MAX_NUM',0,'W');
Drop table W;
Thanks for the background info.
I already tried peek() with no success. But now it works. Seemed to be a mistake in the notation....
Thanks to all for your help. Everything ok now!