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.
I'm going crazy trying to compare a date stored in an amper variable with a normal date. I need to find out if the month and year are the same.
Here's the code to store the first date: [ TABLE FILE CIR_ACCOUNT_METRIC_400 SUM MAX.ACTL_DT ON TABLE HOLD AS HOLD_MAX_DATE FORMAT ALPHA END -RUN -READ HOLD_MAX_DATE &MAX_DATE.A8 -* This returns 04272009
DEFINE FILE CIR_BANKRUPTCY_METRIC Z_DAILYNEWIND/I1=IF ACTL_DT EQ &MAX_DATE THEN 1 ELSE 0; -* This works - it tells whether the dates are equal
DT_ACTL_DT/HYYMDm=HDTTM(ACTL_DT, 8, 'HYYMDm'); Z_MONTHLYNEWIND/D12.2=HDIFF(HDTTM(&MAX_DATE, 8, 'HYYMDm'),DT_ACTL_DT, 'MONTH','D12.2'); -* This fails - it gives answers like 139,057
]
I've tried using a combination of smart dates, HDIFF, HNAME, HDTTM and HINPUT with no success. Help!!This message has been edited. Last edited by: Kerry,
If you need the number of months difference between two dates, you may not need to convert them to date-time, just to date, using the DATECVT function, then use DATEDIF to determine the number of units difference (M for Month):
-SET &MAX_DATE = '04272009';
TABLE FILE EMPLOYEE
PRINT FIRST_NAME
COMPUTE NEW_HIRE_DATE/YYMD = DATECVT(HIRE_DATE, 'I6YMD', 'YYMD');
COMPUTE NEW_DAT_INC/YYMD = DATECVT(&MAX_DATE, 'I8MDYY', 'YYMD');
COMPUTE MONTHS_HIRED/I8 = DATEDIF(NEW_HIRE_DATE, NEW_DAT_INC, 'M');
BY LAST_NAME
WHERE TOTAL MONTHS_HIRED NE 0;
WHERE DEPARTMENT EQ 'PRODUCTION';
END
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
I'd like to do this compare within the DEFINE statement so I can set the indicator for each row. I still haven't figured out how to convert both dates to I8YYMD within the DEFINE.
Francis the DATEDIF function won't work for me because I need to know if the months are the same not if the difference is less than a month. I did use your code to convert my amper date.
Here's how I got it to work using HNAME: [ -SET &MAX_DATE = '04272009';
-* File date2variabl_comp.fex
-SET &VAR_DATE = '011982';
DEFINE FILE EMPLOYEE
VAR_DATE_MNYY/MYY = &VAR_DATE;
HIR_DATE_MNYY/MYY = HIRE_DATE ;
SAME_MONTH/A3 = IF VAR_DATE_MNYY EQ HIR_DATE_MNYY THEN 'YES' ELSE 'no' ;
END
TABLE FILE EMPLOYEE
PRINT
VAR_DATE_MNYY AS 'YYYY/MM,Check'
HIR_DATE_MNYY AS 'Hired,Mo/Year'
SAME_MONTH AS 'Hired,During,&VAR_DATE'
BY FIRST_NAME AS 'First Name'
BY LAST_NAME AS 'Last Name'
-*Use this as required: WHERE SAME_MONTH EQ 'YES';
HEADING CENTER
"These employees were hired during <VAR_DATE_MNYY"
WHERE DEPARTMENT EQ 'PRODUCTION';
ON TABLE SET PAGE OFF
END
Edit out the "27" from what your -READ in (-READ HOLD_MAX_DATE &MAX_DATE.A8 -* This returns 04272009, then EDIT &MAX_DATE as required to get only the 04/2009)
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005