Focal Point
Date operations - how prevent report from running if datediff > 33

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/2567037336

September 25, 2013, 03:15 PM
Josh K
Date operations - how prevent report from running if datediff > 33
I have a report that takes in two dates to display data in a date range. I need to limit it to where it will only allow a range of no more than 1 month. How would I go about that?

This message has been edited. Last edited by: Josh K,


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)
September 25, 2013, 04:10 PM
Josh K
I've figured out at least how to subtract dates.

  
-SET &DATE2 = 20130901;
-SET &WORKDATE = AYMD(&YYMD,0,'I8YYMD') ;
-SET &ZD = &DATE2 - &WORKDATE;


But how do I use this to prevent the report from running if ZD > 33 or is negative, for example?


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)
September 25, 2013, 04:51 PM
Doug
Tip 1: Don't use standard math functions for / with DATES. There are a lot of Date and Time Functions out there just for things like this.

Hint: F1 ... DATE
September 25, 2013, 04:52 PM
Waz
If this fits in with your program and logic, use an IF test then skip the report.

-IF &ZD LT 0 OR &ZD GT 33 THEN GOTO ERR_RANGE ;
.
.
.
-GOTO PGM_END

-ERR_RANGE

-* Error Handler here

-PGM_END



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!