Focal Point
[SOLVED] Compare Date in report to Current Date

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

September 24, 2010, 12:22 PM
Suzy
[SOLVED] Compare Date in report to Current Date
I want to highlight the dates in a report that are in the past. How do I compare these dates?

This message has been edited. Last edited by: Kerry,


WebFOCUS 8.0.08
Solaris
HTML, PDF, XLS, CSV
September 24, 2010, 12:35 PM
Darin Lee
First, the documentation is full or references and functions regarding dates. This forum is as well. Search through those for additional information. Second, &YYMD (and its variations) is the reference to the system date. It can be used in DEFINE/COMPUTE statements, WHERE statements, etc.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
September 24, 2010, 12:59 PM
Suzy
Well this is what I have been trying.
  
COMPUTE CURR_DATE/MDYY='&DATEMDYY'; NOPRINT
COMPUTE PASS_EXPIRED/MDYY=PWD_EXPIRY_DT; NOPRINT
COMPUTE SHOWEXPIRED/A1=IF PASS_EXPIRED LT CURR_DATE THEN 'Y' ELSE 'N'; NOPRINT


And I'm just getting this error.
(FOC282) RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD:
PASS_EXPIRED


WebFOCUS 8.0.08
Solaris
HTML, PDF, XLS, CSV
September 24, 2010, 02:01 PM
Prarie
What is the format of PWD_EXPIRY_DT to begin with?

Take of your noprint and the last compute and that is probably where you are really getting the error. You probably need a function to make it really MDYY
September 24, 2010, 02:35 PM
Spence
See if this helps.

DATE_CREATED is in a date format.

-SET &TODAY = &YYMD;
-SET &TDAY = AYMD (&TODAY, 0, 'I8YYMD');

COMPUTE DATE_CREATED1/I8YYMD = DATE_CREATED;
COMPUTE DATE_CHECK/A1 = IF &TDAY LT DATE_CREATED1 THEN 'Y' ELSE 'N';


WF 8 version 8.2.04. Windows.
In focus since 1990.
September 24, 2010, 03:38 PM
Darin Lee
I don't think you can compare ddates in smart date format using LT, GT, etc. If you convert to alpha, it would have to be A8YYMD to compare. I think Spence's suggestion would get you what you need (he's using I8YYMD which you could use for numeric comparison operators.)


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
September 24, 2010, 03:56 PM
ABT
I have this in the define of a program that does something similar:

NEWTIME/HYYMDIA WITH TODATE=DT(&YYMD 00:00AM);
NEWDAY/HYYMDS = NEWTIME;

PASSED/A1 = IF NEWDAY FROM FROMDATE TO TODATE THEN 'Y' ELSE 'N';

-ABT


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
September 29, 2010, 03:40 PM
Suzy
Thank you Spence that works!


WebFOCUS 8.0.08
Solaris
HTML, PDF, XLS, CSV