Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to create a variable to find the no of days between two dates
Date field in my Table is From_Date
I want to create a date as 31-aug-2014 and
then find difference between
31-Aug-2014-from_date
Pls help me to create variable for this
in ur load script try this,
load ....,
num(makedate(2014,8,31))-num(from_date) as days_past,
.....
from xyz;
This will giv u a field called days_past which has the required number for each and every row. Since there are more than one row u cannot straight away save it to a variable.
Please explain ur requirement, may be a field will help in ur case. since we go for variable only in case of max date, min date, etc.
-Sundar
From_Date - makedate(2014,8,31)
How do you select particular From_Date?
Try like this
Load Max(From_Date) As Max_Dt From Table;
Let Dt = peek('Max_Dt') - Date#('8/31/2014','M/D/YYYY');
TRACE $(Dt);
Thanks
How can I store this in a variable. Pls explain
From Date is recorded in the table against each record
So do you want calculate difference for all rows or one row?
FOR ALL ROWS
see attachment
THAKS FOR YOUR REPLY
BUT IT IS STILL NOT WORKING IN MY MODULE. I HAVE RECORDED FROM_DATE IN THE FOLLOWING FORMAT. IS THAT THE REASON ?
date(floor(FROM_DATE),'DD-MMM-YYYY')AS FROM_DATE,
in ur load script try this,
load ....,
num(makedate(2014,8,31))-num(from_date) as days_past,
.....
from xyz;
This will giv u a field called days_past which has the required number for each and every row. Since there are more than one row u cannot straight away save it to a variable.
Please explain ur requirement, may be a field will help in ur case. since we go for variable only in case of max date, min date, etc.
-Sundar