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.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
DATEDIF help
 Login/Join
 
Member
posted
Hello, I was just doing a quick querry to an amper variable to type out the difference in days between two dates and I constently get a return of 0 Here is the code I am using to try and get what I am looking for:

-SET &DAYSAGO = DATEDIF(20050202, 20080410, 'D');
-TYPE The report was last run &DAYS_AGO days ago.

Every time I try this, I get a 0 in the &DAYS_AGO variable. I'm starting to rip my hair out.

Any suggestions would be wonderful.
 
Posts: 3 | Registered: April 10, 2008Report This Post
Platinum Member
posted Hide Post
Mark,

Here's how to do it in Dialogue Manager:

-SET &DATE1 = 20080101;
-SET &DATE2 = 20080412;
-SET &DIFF = YMD(&DATE1, &DATE2);

-TYPE DIFF: &DIFF


Regards,
Sean


------------------------------------------------------------------------
PROD: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
TEST: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
 
Posts: 210 | Location: Ottawa | Registered: November 03, 2005Report This Post
Member
posted Hide Post
Right on. Thank you very much. Any idea why DATEDIF is not working correctly?
 
Posts: 3 | Registered: April 10, 2008Report This Post
Platinum Member
posted Hide Post
Mark,

We use DATEDIF in TABLE FILE, but not in DM. WF has different functions sometimes between TABLE FILE and DM to accomplish the same operation.

Regards,
Sean


------------------------------------------------------------------------
PROD: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
TEST: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
 
Posts: 210 | Location: Ottawa | Registered: November 03, 2005Report This Post
Member
posted Hide Post
Thank you very much. It worked wonderfully.
 
Posts: 3 | Registered: April 10, 2008Report This Post
Master
posted Hide Post
The date funcions (DATEDIF, DATEMOV, etc.) do not work with DM variable. This is documented. They work with FOCUS smart date fields. DM variables are just strings of data. For example 20080411 could be Apr 11th, 2008 or it could be 20,080,411. To use these date function, you have to first use DATECVT to convert the string to a smart date and when the computation is done convert the smart date back to a string.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report This Post
Virtuoso
posted Hide Post
That is partly correct. the DATEDIF,DATEMOV,DATEADD et.al. function only work with smart dates. So by following your suggestion of using DATECVT to tell DM whether you are using strings or dates, it is possible to get what you need in DM with these functions. The following uses DATEMOV and DATEADD to calculate the end date of next month.
-SET &ECHO=ALL;
-SET &PBEG=DATECVT (&YYMD, 'I8YYMD', 'YYMD');
-SET &END_NEXT = DATEADD(&PBEG,'M','1');
-SET &EOM = DATEMOV(&END_NEXT.EVAL,'EOM');
-SET &ENDDTA=DATECVT (&EOM.EVAL,'YYMD','A8YYMD');
-TYPE &ENDDTA


We have been successfully using these functions in DM with no issues. Use of the DATECVT function along with them is the key.


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
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders