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
HPART revisited
 Login/Join
 
Platinum Member
posted
hi all, having yet another problem with hpart. It seems that weekfirst doesn't have any effect on the week being returned when using hpart. The following is a test I did changing weekfirst through all the setting (1-7) and nothing was different. Any body know if I missing something or if this is problem that needs to be fixed?

here's the code:


-SET WEEKFIRST = 1;
DEFINE FILE CASHFLOW

RDATE1/HYYMD = DT(20040804 12:00:00);
RDATE2/HYYMD = DT(20040805 12:00:00);
RDATE3/HYYMD = DT(20040806 12:00:00);
RDATE4/HYYMD = DT(20040807 12:00:00);
-*
RDATE1_WEEK/I3 = HPART(RDATE1, 'WEEK', 'I3');
RDATE2_WEEK/I3 = HPART(RDATE2, 'WEEK', 'I3');
RDATE3_WEEK/I3 = HPART(RDATE3, 'WEEK', 'I3');
RDATE4_WEEK/I3 = HPART(RDATE4, 'WEEK', 'I3');
-*
END

TABLE FILE CASHFLOW
-* Generated by Report Assist
PRINT CASH_DATE RDATE1 RDATE1_WEEK RDATE2 RDATE2_WEEK RDATE3 RDATE3_WEEK RDATE4 RDATE4_WEEK
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET PAGE-NUM OFF
ON TABLE SET STYLE DEFLT
END
here's my output:


Date of
Statement RDATE1 RDATE1_WEEK RDATE2 RDATE2_WEEK RDATE3 RDATE3_WEEK RDATE4 RDATE4_WEEK
01/02/1997 2004/08/04 31 2004/08/05 31 2004/08/06 31 2004/08/07 32
01/03/1997 2004/08/04 31 2004/08/05 31 2004/08/06 31 2004/08/07 32
01/04/1997 2004/08/04 31 2004/08/05 31 2004/08/06 31 2004/08/07 32

This message has been edited. Last edited by: <Mabel>,
 
Posts: 157 | Location: Secaucus, NJ | Registered: May 21, 2004Report This Post
Expert
posted Hide Post
um, August 4,5,6, and 7 are all in week 31, so i don't see a prob. Can you explain what it is you expect to see?
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Platinum Member
posted Hide Post
IF YOU LOOK, IT PUTS 8/07 IN WEEK 32.
 
Posts: 157 | Location: Secaucus, NJ | Registered: May 21, 2004Report This Post
Expert
posted Hide Post
oh, yeah i see that now. it ran off my screen.
The Variable WEEKFIRST is a system var and you're making it an amper var, sort of.
Take the dash out.
SET WEEKFIRST = 1
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Platinum Member
posted Hide Post
yeah, I was trying every way possible and that must have been my last trial. I just tried it all again and there was no difference.

is it possible that there is a system default?
 
Posts: 157 | Location: Secaucus, NJ | Registered: May 21, 2004Report This Post
<Pietro De Santis>
posted
Well, it looks like Sunday is not the first day of the week by default.

Add the following to the program and it should work:

SET WEEKFIRST=1
quote:
Specifies a day of the week as the start of the week. This is used in week computations
by the HDIFF, HNAME, HPART, and HSETPT functions.
The WEEKFIRST parameter does not change the day of the month that corresponds to
each day of the week, but only specifies which day is considered the start of the week.
quote:
SET WEEKFIRST = { n|7}
where:
n
Is a number from one to seven, where one represents Sunday and seven
represents Saturday. The default value is seven, which is consistent with the
Microsoft SQL Server convention.
Pietro.
 
Report This Post
Platinum Member
posted Hide Post
hey pietro, if you follow my code above, you'll see that I tried that. Don't mind the '-' in front of the set statement, that was just a trial that failed. I tried every value and nothing seemed to change. By default I mean a system override that will ignore the code.
 
Posts: 157 | Location: Secaucus, NJ | Registered: May 21, 2004Report This Post
<Pietro De Santis>
posted
Interesting, because, when I added the weekfirst command, it worked:


SET WEEKFIRST=1

DEFINE FILE CAR
RDATE1/HYYMD = DT(20040804 0:00:00);
RDATE2/HYYMD = DT(20040805 0:00:00);
RDATE3/HYYMD = DT(20040806 0:00:00);
RDATE4/HYYMD = DT(20040807 0:00:00);
RDATE1_WEEK/I2 = HPART(RDATE1, 'WEEK', 'I2');
RDATE2_WEEK/I2 = HPART(RDATE2, 'WEEK', 'I2');
RDATE3_WEEK/I2 = HPART(RDATE3, 'WEEK', 'I2');
RDATE4_WEEK/I2 = HPART(RDATE4, 'WEEK', 'I2');
END

TABLE FILE CAR
PRINT
MODEL NOPRINT
RDATE1 RDATE1_WEEK
RDATE2 RDATE2_WEEK
RDATE3 RDATE3_WEEK
RDATE4 RDATE4_WEEK
END

This message has been edited. Last edited by: <Mabel>,
 
Report This Post
Platinum Member
posted Hide Post
see there you go again helping me when I'm stuck. You would'nt beleive what the problem was! it was the semi-colon after the weekfirst statement. I took it out and everything worked the way it should of.


Wheww....thought I was going crazy,...actually I was...
 
Posts: 157 | Location: Secaucus, NJ | Registered: May 21, 2004Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders