Focal Point
[SOLVED] Issue with retrieving records from 2 days prior

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

June 29, 2017, 02:03 PM
dwonlee
[SOLVED] Issue with retrieving records from 2 days prior
Hi, I am trying to create a report that filters records that were created from the past two days but the filter has to be dynamic so it can be run on any day.

I have tried the following:
DEFINE FILE CREATEDATE
CURRENTDATE/HYYMD=HGETC(8 ,CURRENTDATE );
DATEDIFF/HYYMD=HADD (CURRENTDATE,'year',-2, 8,'HYYMD');
END

--with--

WHERE CREATEDDATE GE DATEDIFF;

but when I switch out 'year' to 'day' it does not work. It does not give me an error but just keeps loading.

I am running WF 8201M. Any feedback would be appreciated. Thanks!

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


WebFOCUS 8201M
Windows, All Outputs
June 29, 2017, 02:43 PM
MartinY
Try with this instead
-* SET TEST DATE AS 2 DAYS AGO FROM CURRENT DATE
-SET &TWO_D_AGO = AYMD(&YYMD, -2, 'YYMD');

TABLE FILE CREATEDATE
...
WHERE CURRENTDATE GE &TWO_D_AGO;
END



WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
June 29, 2017, 02:51 PM
FP Mod Chuck
Hi Dwonlee

First of all welcome to Focal Point. This forum is a great place to get help with development questions from a lot of very knowledgeable customers and IBI staff.

The date you need to be comparing to needs to be in the database table your are reporting against. Your example makes this a little confusing as it appears you are DEFINING a field to be CURRENTDATE. What you are trying to do is possible against a real date field.

Put this code at the beginning of your procedure.


-SET &TWODAYSPRIOR = AYMD(&YYMD,-2,I8YYMD);


Then your WHERE statement should be.


WHERE COMPAREDATE GE &TWODAYSPRIOR


COMPAREDATE should be the date field stored in the database table you are reporting against.

Hope this helps


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
June 29, 2017, 02:52 PM
FP Mod Chuck
Didn't see Martin's reply but we both have the same solution which is good...


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
June 29, 2017, 03:10 PM
dwonlee
Martin and Chuck,

I appreciate the warm welcome Smiler

Thanks for your quick reply! Your solution works for me and it was definitely a more efficient solution to my report.


WebFOCUS 8201M
Windows, All Outputs