Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculation on date

Status
Not open for further replies.

H1004

MIS
Oct 28, 2003
136
US
I search for other thread concerning this issue, but it doesn't help my situation.

I have a graph in (FEX1) with a requested_date as a drill down parameter into FEX2.
It passes in a date with the following format: 2004/12/05

After it passes in, I want to add 7 days to it, so the result is 2004/12/12. Instead, when I execute my code, it gave me 1901/02/03.

Here is my code:
SELECTDT/YYMD = &REQDATE + 7;

What am I doing wrong?
Please help!!
Thank you.

 
I even try doing this, and it still doesn't work.

SELECTDT/YYMD = DATEADD(&RCD, 'D', 7)
 
I figure it out on how to calculate it, but then I'm having difficulty trying to get WKDT or MTHDT into variable so that I can use it in my where statement.

Example:
WHERE REQUESTED_DATE LE '&ADVDATE';

Here is my code:

DEFINE FILE ALLWORK4SCHED
DATE1/YYMD='&RCD';
WKDT/YYMD = DATEADD(DATE1, 'D', 7);
MTHDT/YYMD = DATEADD(DATE1, 'M', 1.99);
END

-SET &ADVDATE = <WKDT;

However, the report doesn't recognize &ADVDATE as YYMD format. But then I can't use
-SET &ADVDATE/YYMD = <WKDT;

Any helpful hint is greatly appreciated

 
You're confusing Dialogue Manager variables (beginning with '&') with data retrieved values (inserted into text with a '<').

The easiest solution is to use the DEFINEd field in your WHERE test, like this:

WHERE date_field EQ WKDT

Or, you can put the calculation into the WHERE, like this:

WHERE date_field eq DATEADD(DATE1, 'D', 7)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top