Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
What is error in following statement?
let VMaxTrxnDate=max(TRXDATE);
check whether TRXDATE is in DATE or Number format ?
if TRXDATE is a column/field of a table this is not possible
you may build a temporary table to get the max(TRXDATE) and then
assign to a variable using peek function
LET VMaxTrxnDate=peek('yournewfield',x) x 0 or -1 depends on order of your temp table
Let evaluates the expression and this expression cannot be evaluated at load time. Perhaps you want to use this in the front end. Change the let to set:
set VMaxTrxnDate = max(TRXDATE);
or
set VMaxTrxnDate = '=max(TRXDATE)';
Now you can use VMaxTrxnDate in front end expressions.
So you mean to say if I assign any field value directly to Let variable, it will never work?
Through Peek() I need to assign, if not Temp table?
Avinash ,Format is not a concern...
I have a similiar Problem where I Need to get Dates out of a fact table and Loop through them
i use
Timetab:
NoConcatenate load Distinct
MyDate
Resident Timetab1
order by 1 asc;
in a Loop i use this statement
LET vNoRows = noofrows('Timetab'); // number of months
for i= 0 to vNoRows //
Let vDate = peek(MyDate,i,'Timetab');
Thats Fine.
What I am looking for is:
Is their any alternate way to fetch the maximum date entry value without taking resident of it?
Not to my knowledge
That's why I use the peek function
Oky, But again to do it with Peek() I need to go for resident load which I dont want...