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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Calculate number of months

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Calculate number of months
 Login/Join
 
Virtuoso
posted
I want to calculate the number of months between a amper date (&YYMD) and a database date.

I tried this, but the result are wrong.

DATE is a field form the database

DEFINE FILE AH0124FA
PEREOM/YYMD=DATEMOV(DATE,'EOM'); 
TODAY/YYMD='&YYMD';
ACTEOM/YYMD=DATEMOV(TODAY,'EOM');
THISMAAND/YYM=TODAY;
MDIF/I5=DATEDIF(PEREOM,ACTEOM,'M');
END





Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Virtuoso
posted Hide Post
Frank

I've tried this and it seems fine. What is wrong with the results you are getting?


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Guru
posted Hide Post
Doesn't DATEDIF need four arguments: DATEDIF(from_date, to_date, 'unit', outfield) ?


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
Virtuoso
posted Hide Post
jimster06

Only for Maintain.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Virtuoso
posted Hide Post
Maybe it's fixed in 7.6
I get not the numbers I would expect, and in the book 1001 etc I found this as a know error .




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Virtuoso
posted Hide Post
Frank,

Did you verify that your input dates are what they should be?

Just a thought.


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
 
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003Report This Post
Gold member
posted Hide Post
Frank, it sounds like a simple subtraction should work for you- e.g.

-SET &YYM = EDIT(&YYMD,'999999') ; 
                                   
...                                
                                   
MYNEWM/YYM  = MYNEW ;              
MYYM/YYM WITH DVAL = '&YYM' ;      
MDIF/I5 = MYYM - MYNEWM ;          



IBI Development
 
Posts: 61 | Registered: November 15, 2005Report This Post
Virtuoso
posted Hide Post
I'll give it a try (Monday), thanks for the suggestions.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Guru
posted Hide Post
The system date, &YYMD is not in smart date YYMD format.
It is in I8YYMD format. You have to convert it to a smart date with DATECVT before you can use it in a smart date function like DATEMOV.

PEREOM/YYMD=DATEMOV(DATE,'EOM'); 
TODAY/YYMD=DATECVT(&YYMD,'I8YYMD','YYMD');
ACTEOM/YYMD=DATEMOV(TODAY,'EOM');


(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
 
Posts: 391 | Location: California | Registered: April 14, 2003Report This Post
Expert
posted Hide Post
           
WHAT/YYMD   =  &YYMD  ;      

now actually seems to work.
it seems its gotten easier to make a smartdate out of an integer string.
in 764 anyway.
zowie, batman.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Master
posted Hide Post
I've been doing this for 20 years:
CURRDT/YYMD=&YYMD;

Even back in regular FOCUS it has always worked (at least in PC, VAX and UNIX it has).

When I want months between 2 dates I do this:
CURRDT/YYMD=&YYMD;
DIFFMTH/I4=DATEDIF(DATE,CURRDT,'M');

I've never seen anytime this didn't work.


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
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Calculate number of months

Copyright © 1996-2020 Information Builders