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

Read-Only Read-Only Topic
Go
Search
Notify
Tools
HPART Problems
 Login/Join
 
Platinum Member
posted
Hi Guys, I'm having some trouble calcualting dates using the hpart function. The following code seems to only generate zero's for the HPART functions. Any Ideas why?




WK_DATE/YYMD = &YYMD;
BASEDATE/YYMD=DATECVT(20040101,'I8YYMD', 'YYMD');

WK_MONTH/I2 = HPART(WK_DATE,'MONTH','I2');
WK_DAY/I2 = HPART(WK_DATE,'DAY','I2');
WK_YEAR/I4 = HPART(WK_DATE,'YEAR','I4');


SALES_WEEK/I5 = HPART(WK_DATE, 'WEEK', 'I5');
SALES_WK/I5 = (DATEDIF( BASEDATE, WK_DATE,'D') + 1) / 7 ;

Thanks, Lloyd

This message has been edited. Last edited by: <Mabel>,
 
Posts: 157 | Location: Secaucus, NJ | Registered: May 21, 2004Report This Post
Silver Member
posted Hide Post
Loyd,

I think the problem is that the HPART is expecting a DATE-TIME value and you are only supplying a DATE value. I tried the following and was able to get the HPART function to work:

WK_DATE2/HYYMDIA = DT(&YYMD.EVAL 09:00AM);
WK_MONTH/I2 = HPART(WK_DATE2 ,'MONTH','I2');

Then I got the Month to show up in the report.

Jon
 
Posts: 39 | Registered: January 26, 2004Report This Post
Guru
posted Hide Post
Lloyd-
You are on the right track. The HPART function assumes that you are using an H form date/time variable. Put your WK_DATE and BASEDATE variables into H form such as HYYMDs and then work from there.
Take a look at how HCNVRT and HINPUT are used in the WF Function manual, p7-42, WF5.2.
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders