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] Day of week chronologically ordered?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Day of week chronologically ordered?
 Login/Join
 
Virtuoso
posted
A report we're working on should display a graph with on the X-axis the day of the week (Mon, Tue, Wed, etc), starting today with values that go up to a week back in the past.

Sounds simple, but we're stuck!
The items on the X-axis are based on date and should be ordered chronologically, not by day of the week number or alphabetically. Which is what we tend to get as a result...

For example, today (Wednesday) the X-axis should read: "Thu Fri Sat Sun Mon Tue Wed".

It's okay to add relevant extra information on the X-axis, such as the week number, but actual dates are considered too detailed.

I managed the below (the week number on the X-axis is extra), but it breaks around new year:
DEFINE FILE CALENDAR
 DoW/wt=DATECVT(DATE, 'I8YYMD', 'YYMD');
END
GRAPH FILE CALENDAR
SUM DOWNR
BY WEEKNR
BY DoW
WHERE DATE FROM 20120202 TO 20120208;
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET HAXIS 770
ON GRAPH SET VAXIS 405
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 2
END

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


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
Expert
posted Hide Post
Consider building a list of desired Weekdays in your desired order (Example: -SET &DaysOfWeek = 'xxx'; , which results in something like this: 'Sat' AND 'Sun' AND 'Mon' AND 'Tue' AND 'Wed' AND 'Thu' AND 'Fri') and using that in
ACROSS DoW AS '' COLUMNS &DaysOfWeek.EVAL




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Virtuoso
posted Hide Post
Ah, that does it. Thanks!
Added benefit: Any days in the week for which there was no record now shows up in the graph too.

I ended up with this code, which is probably a little suboptimal:
-SET &DOW = DOWK(&YYMD, 'A3');
-SET &WEEKDAYSMON = 'Mon AND Tue AND Wed AND Thu AND Fri AND Sat AND Sun';
-SET &WEEKDAYSTUE = 'Tue AND Wed AND Thu AND Fri AND Sat AND Sun AND Mon';
-SET &WEEKDAYSWED = 'Wed AND Thu AND Fri AND Sat AND Sun AND Mon AND Tue';
-SET &WEEKDAYSTHU = 'Thu AND Fri AND Sat AND Sun AND Mon AND Tue AND Wed';
-SET &WEEKDAYSFRI = 'Fri AND Sat AND Sun AND Mon AND Tue AND Wed AND Thu';
-SET &WEEKDAYSSAT = 'Sat AND Sun AND Mon AND Tue AND Wed AND Thu AND Fri';
-SET &WEEKDAYSSUN = 'Sun AND Mon AND Tue AND Wed AND Thu AND Fri AND Sat';
-SET &WEEKDAYS = &WEEKDAYS.&DOW;

DEFINE FILE CALENDAR
 DoW/wt=DATECVT(DATE, 'I8YYMD', 'YYMD');
END
GRAPH FILE CALENDAR
SUM DOWNR
ACROSS DoW COLUMNS &WEEKDAYS.EVAL
WHERE DATE FROM 20120202 TO 20120208;
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET HAXIS 770
ON GRAPH SET VAXIS 405
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
END


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
Virtuoso
posted Hide Post
quote:
which is probably a little suboptimal


Hmm, probably not ... I actually like what you did. Simple is better I guess.

One could get a bit more elaborate and do something like this:

-SET &DOW          = LCWORD(3, DOWK(&YYMD, 'A3'), 'A3');
-SET &WEEKDAYSLIST = 'Mon AND Tue AND Wed AND Thu AND Fri AND Sat AND Sun AND Mon AND Tue AND Wed AND Thu AND Fri AND Sat';
-SET &DAYPOS       = POSIT(&WEEKDAYSLIST, &WEEKDAYSLIST.LENGTH, &DOW, 3, 'I3');
-SET &WEEKDAYS     = SUBSTR(&WEEKDAYSLIST.LENGTH, &WEEKDAYSLIST, &DAYPOS, &DAYPOS + 50, 51, 'A51');


Less lines, yes. Optimal/efficient? debatable.

You probably don't need that .EVAL after &WEEKDAYS in the ACROSS line.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Expert
posted Hide Post
quote:
ON GRAPH SET HTMLENCODE ON

what does this do?
i'm only in 768 (sigh)
..
this is a kickin thread! brillliant




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Virtuoso
posted Hide Post
Good question! That command was inserted by the Advanced Graph editor, but it's not listed in our Help files it seems...

I assume it escapes characters that are special to HTML (and probably XML too). I doubt it would do much in PNG or JPEG output, but it could be important to SVG output as under the hood that is an XML format.

I did some quick tests, but it didn't seem to make any difference whether I set HTMLENCODE to ON or OFF...


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
Gold member
posted Hide Post
Here is yet another way that you could put the weekdays in a list

-SET &WEEKDAYS='';
-REPEAT :WEEKLOOP FOR &N FROM 1 TO 7
-SET &WEEKDAYS=IF &N EQ 1 THEN LCWORD(3,DOWK(&YYMD+&N, 'A3'),'A3') ELSE &WEEKDAYS || ' AND ' | LCWORD(3,DOWK(&YYMD+&N, 'A3'),'A3');
-:WEEKLOOP


WF: 8201, OS: Windows, Output: HTML, PDF, Excel
 
Posts: 78 | Registered: November 08, 2010Report This Post
Virtuoso
posted Hide Post
Nice solution, but that breaks on weeks that cross a month:
-SET &WEEKDAY1 = DOWK(20120229, 'A3');
-TYPE Last day of February: &WEEKDAY1
-SET &WEEKDAY2 = DOWK(20120230, 'A3');
-TYPE Next day (empty): &WEEKDAY2


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
Gold member
posted Hide Post
Oops forgot that unlike with define fields it doesn't work like a smartdate. Changed it so it works.

-SET &WEEKDAYS='';
-REPEAT :WEEKLOOP FOR &N FROM 1 TO 7
-SET &WEEKDAYS=IF &N EQ 1 THEN LCWORD(3,DOWK(AYMD(&YYMD,&N,'I8YYMD'), 'A3'),'A3') 
-ELSE &WEEKDAYS || ' AND ' | LCWORD(3,DOWK(AYMD(&YYMD,&N,'I8YYMD'), 'A3'),'A3');
-:WEEKLOOP


WF: 8201, OS: Windows, Output: HTML, PDF, Excel
 
Posts: 78 | Registered: November 08, 2010Report 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] Day of week chronologically ordered?

Copyright © 1996-2020 Information Builders