Focal Point
Day of the week

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/2681032762

January 21, 2008, 03:43 AM
Majid Jeddi
Day of the week
Hi,

I am using 'DayOfWeek/I1=HPART(SHIFTDATE, 'WEEKDAY', 'I1');
' to return the day number 1 for Sunday, 2 for Monday and so on.
But to force the system to use Monday as the first day of the week, in one fo my reports I did the following:
SET WEEKFIRST=2.
My report is still showing 1 for saturday 2 for Monady and so on.

Is this the usage of WEEKFIRST?.

Thanks


WebFocus 7.6.5
AND WebLogic server as web server
sql2005 as database server
January 21, 2008, 04:24 AM
Tony A
Try this code to see the differences between taking the WebFOCUS W format and what you are attempting to get -
PRINT SHIFTDATE
      COMPUTE DAY_NO/W   = HDATE(SHIFTDATE, 'YYMD');
      COMPUTE DAY_NOH/I2 = HPART(SHIFTDATE, 'WEEKDAY', 'I2');
IF RECORDLIMIT EQ 100

Try it with and without your WEEKFIRST setting to understand what that setting affects and what is not affected.

Remember, that there may be many ways of doing what you need and you have to think laterally to ensure that you cover those possibilities.

Open your mind Smiler

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
January 21, 2008, 06:47 AM
Majid Jeddi
Hi Tony,

Thanks for your answer.

The WEEKFIRST has no impact on the result.
The result of the 2 fields remains unchanged.

How is WEEKFIRST is supposed to impact the result?.

Regards.

Majid


WebFocus 7.6.5
AND WebLogic server as web server
sql2005 as database server
January 21, 2008, 08:25 AM
Tony A
What does the manual say?

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
January 21, 2008, 10:05 AM
susannah
the HPART function seems to have a problem
here's a reported problem
and if you look at this thread, there's some discussion today about another problem with the same function;
i couldn't get WEEKFIRST to have any effect on it, either.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
January 22, 2008, 06:38 AM
Majid Jeddi
Hi Susannah,

That was also the results of my tests. This parameter has no effect on the HPART as it is stated in the documentation.

Thanks for your help.

Regards.


WebFocus 7.6.5
AND WebLogic server as web server
sql2005 as database server
January 22, 2008, 11:47 AM
susannah
alas.
We really do need Renee to visit this post and help us out.
Kerry... please ask Renee to visit us.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
January 29, 2008, 05:37 PM
Renee Teatro
Hi Susannah and all:

I apologize for the day in response but I have been out of the office. I reviewed this thread and the WEEKFIRST setting will not have an effect on the WEEKDAY component in the HPART subroutine. The WEEKFIRST setting is meant to impact the WEEK component. I briefly reviewed the other thread mentioned and that thread is using the WEEK component in conjunction with the WEEKFIRST setting. Ed Wolfgram provided a great deal of useful information and there is the known issue that you pointed to as well. Let me take a look at that other thread in detail and I will update that thread sometime tomorrow.

Renee
January 30, 2008, 08:54 AM
PBrightwell
Majid,

If you are getting 1 for Sunday and want 1 to be Monday, as a work around you could do a decode to change it.
DayofWeek1/I2=DECODE DayOfWeek( 1 7
2 1
3 2
4 3
5 4
6 5
7 6);


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
February 12, 2014, 01:52 PM
Francis Mariani
I'm still looking for a clean solution (without DECODE) to getting the Day of the Week, where Monday is 1.

Can't use the fancy function DATETRAN.


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
February 12, 2014, 03:16 PM
susannah
DEFINE FILE IBISAMP/CAR
TODAY/YYMD WITH COUNTRY = &YYMD.EVAL ;
BOWDATE/YYMD WITH COUNTRY = DATEMOV( TODAY , 'BOW' );
DAYNUM/I2 = 1 + TODAY - BOWDATE ;
END
TABLE FILE IBISAMP/CAR
HEADING
"TODAY IS &DATEwMtDYY"
PRINT TODAY BOWDATE DAYNUM
END

howzat?




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
February 12, 2014, 04:34 PM
Francis Mariani
zatisgoot!


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
February 13, 2014, 10:37 AM
George Patton
Ja, zatisgoot - but I'm confused about something.

I ran the code in the CAR app, and it gave me today's date as Tuesday,Feb 11, when in fact it's Thursday, Feb 13. Then I rejigged it to reference one of my own application and it gave me Thursday.

We have only one server, so what gives ?


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
February 13, 2014, 10:47 AM
susannah
you've discovered time travel.
its a new feature in 77
February 13, 2014, 11:51 AM
Francis Mariani
I found something weird with the fancy-schmancy DATETRAN function.

I ignored the comment in the doc that to get the Day of Week, the input date must have only W (Day of Week) format because I thought it was a ridiculous requirement. Of course I get the wrong Day of Week. So you have to transform a YYMD date to W and then use that to get the Day of Week in alpha format, but you can't use DATETRAN to get the Day of Week in numeric format.


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
February 13, 2014, 02:46 PM
susannah
nor can you use DOWK to get it in numeric format.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID