Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Error in Let statement

What is error in following statement?

let VMaxTrxnDate=max(TRXDATE);

12 Replies
avinashelite

check whether TRXDATE is in DATE or Number format ?

Anonymous
Not applicable
Author

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

jonathandienst
Partner - Champion III
Partner - Champion III

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.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

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?

Anonymous
Not applicable
Author

Avinash ,Format is not a concern...

Anonymous
Not applicable
Author

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');

Anonymous
Not applicable
Author

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?

Anonymous
Not applicable
Author

Not to my knowledge

That's why I use the peek function

Anonymous
Not applicable
Author

Oky, But again to do it with Peek() I need to go for resident load which I dont want...