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     [solved] Week Number

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[solved] Week Number
 Login/Join
 
Member
posted
Hi,

I currently have I8YYMD date format and need to get the week number of the year from this.

Any help would be appreciated.
Thanks!

This message has been edited. Last edited by: ARandolph,


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 3 | Registered: May 31, 2013Report This Post
Master
posted Hide Post
http://forums.informationbuild...71057331/m/930104551


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
 
Posts: 573 | Location: Baltimore, MD | Registered: July 06, 2006Report This Post
Member
posted Hide Post
Thanks Tomsweb

I am actually looking for the calendar week of the year going back in time, and not the week based on the current time period.

Hpart seems to be aproblem because i do not have minutes, seconds etc...


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 3 | Registered: May 31, 2013Report This Post
Master
posted Hide Post
Then you need to create a string with minutes, seconds, etc. suffixed to it.
From there you should be able to build variable(s) to solve your problem.

Good luck.


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
 
Posts: 573 | Location: Baltimore, MD | Registered: July 06, 2006Report This Post
Silver Member
posted Hide Post
Did you get there?
I have used in the past:

where HRDT1 is I8YYMD

HRDT2/MDYY= HRDT1;
HRDT3/HYYMDS= HDTTM(HRDT2, 8, 'HYYMDS');
THISWEEK/I2 = HPART(HRDT3,'WEEK','I2');


7.7.05 Windows.
 
Posts: 39 | Location: UK | Registered: July 11, 2012Report This Post
Master
posted Hide Post
I don't know if the following is of any use, but it's what I use for one of my reports. BLDATE is a smartdate in my case. I create a datetime field and go from there. I then extrapolate that to periods each containing 4 weeks.

If you first convert your I8YYMD to a smartdate the rest is fairly straightforward.

Also, note that my conversion to a datetime used HYYMDI, not HYYMDS, which cuts out the necessity of dealing with minutes and seconds. ( I wish I had remembered this a couple of weeks ago when I created a new database with a datetime field of HYYMDS and then in subsequent reports had to filter out the time element that I didn't want in the first place)

BLDATETIME/HYYMDI=HDTTM(BLDATE, 8, 'HYYMDI');
WEEKNUM/I2=HPART(BLDATETIME, 'WEEK', 'I2');
PERIOD/I2=IF WEEKNUM EQ 52 THEN 0 ELSE
		IF WEEKNUM GE 1 AND WEEKNUM LE 4 THEN 1 ELSE
		IF WEEKNUM GE 5 AND WEEKNUM LE 8 THEN 2 ELSE
		IF WEEKNUM GE 9 AND WEEKNUM LE 12 THEN 3 ELSE
		IF WEEKNUM GE 13 AND WEEKNUM LE 16 THEN 4 ELSE
		IF WEEKNUM GE 17 AND WEEKNUM LE 20 THEN 5 ELSE
		IF WEEKNUM GE 21 AND WEEKNUM LE 24 THEN 6 ELSE
		IF WEEKNUM GE 25 AND WEEKNUM LE 28 THEN 7 ELSE
		IF WEEKNUM GE 29 AND WEEKNUM LE 32 THEN 8 ELSE
		IF WEEKNUM GE 33 AND WEEKNUM LE 36 THEN 9 ELSE
		IF WEEKNUM GE 37 AND WEEKNUM LE 40 THEN 10 ELSE
		IF WEEKNUM GE 41 AND WEEKNUM LE 44 THEN 11 ELSE
		IF WEEKNUM GE 45 AND WEEKNUM LE 48 THEN 12
		ELSE 13;

This message has been edited. Last edited by: George Patton,


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
 
Posts: 674 | Location: Guelph, Ontario, Canada ... In Focus since 1985 | Registered: September 28, 2010Report This Post
Virtuoso
posted Hide Post
If you require ISO8601 week numbers, don't forget to set to set WEEKFIRST.

Week-numbers are dangerous to use if you don't accompany them with the accompanying year, which is not necessarily the same year as the one in the date in weeks 1, 52 and 53.

I just implemented it like this earlier today:
SET WEEKFIRST = ISO2

TABLE FILE FOO
SUM
	COMPUTE REQUIRED_READY/HYYMDS = MAX.DATE1;									NOPRINT
	COMPUTE DAYOFYEAR/D3	= HPART(REQUIRED_READY, 'day-of-year', DAYOFYEAR);	NOPRINT
	COMPUTE WEEK/D3			= HPART(REQUIRED_READY, 'week', WEEK);				NOPRINT
	COMPUTE CALYEAR/D4c		= HPART(REQUIRED_READY, 'year', CALYEAR);			NOPRINT
	COMPUTE YEAR/D4c		= IF WEEK EQ 1 AND DAYOFYEAR GT 7 THEN CALYEAR +1
								ELSE IF WEEK GE 52 AND DAYOFYEAR LT 7 THEN CALYEAR -1
								ELSE CALYEAR; NOPRINT
END


I'm fairly certain that's correct, but this time of year is hardly a corner-condition for this code :P


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Member
posted Hide Post
Thank you all, I got it to work.


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 3 | Registered: May 31, 2013Report 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     [solved] Week Number

Copyright © 1996-2020 Information Builders