Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


Connect to myibi
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Sntax for using TODAY function in calculated field

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Sntax for using TODAY function in calculated field
 Login/Join
 
Member
posted
Hi All.
Sorry for what is probably a simple question but I can't find any documentation on this.
I want to calculate the number of days between a date on my database and the current date. My db date is a date time field so I used HDATE to convert this.
Then I wanted to use DATEDIF to get the number of days between that date and the current date but the only way I could see of getting the current date was the TODAY function. However I put this into the DATEDIF function I get an error, usually along the lines of invalid argument for TODAY.

Can anyone help please?
Thank you...

This message has been edited. Last edited by: <Kathryn Henning>,


Release 8
Windows 7
Excel/HTML/PDF
Oracle 11g
 
Posts: 16 | Registered: October 23, 2012Report This Post
Guru
posted Hide Post
The problem iwth TODAY is that it returns an string representation of the date, which DATEDIF doesn't like.

I usually use the following:

DDFIF/I9 = DATEDIF('&YYMD', ORDER_DATE, 'Y');

OR

DDFIF/I9 = DATEDIF('&DATEYYMD', ORDER_DATE, 'Y');

Regards

Stuart


WebFOCUS 8.2.03 (8.2.06 in testing)
 
Posts: 253 | Location: Melbourne, Australia | Registered: February 07, 2007Report This Post
Member
posted Hide Post
Hello - Perhaps this will help? The first set statement is used in an include member and may need a little reworking for this purpose...

-SET &Current_dt = HCNVRT(HGETC(10,'HYYMDm'),'(H20)',20,'A20');
CURDTTIM/HYYMDm = HINPUT(20, '&Current_dt', 8, CURDTTIM);
DIFF_DAYS/D10 = HDIFF(end_date_for_calculation, CURDTTIM, 'DAY', 'D10');


Production: WebFocus 8.0.09 Test: WebFocus 8.0.09 Windows, Z-Linux, and ZOS.
all output
Focus - 7.2.7
 
Posts: 12 | Registered: July 21, 2010Report This Post
Member
posted Hide Post
Thanks for the replies.
I checked both methods and could use either, but the requester decided they could do without that field on the report this time so I haven't had to choose.
At least I'll know for next time...


Release 8
Windows 7
Excel/HTML/PDF
Oracle 11g
 
Posts: 16 | Registered: October 23, 2012Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Sntax for using TODAY function in calculated field

Copyright © 1996-2020 Information Builders