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     [How To] Output data from Webfocus into a HTML Calendar

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[How To] Output data from Webfocus into a HTML Calendar
 Login/Join
 
Gold member
posted
After scavenging for help and attempting this several ways I thought I would finally post my solution for taking dates from a Webfocus data source and outputting it into an HTML calendar.

For my example I used the EMPDATA table and added each employee's upcoming anniversary date and year(s) of service. To display the HTML calendar I chose to use an outside product ScriptCalendar which seems to have many additional features. This calendar product is somewhat affordable, very easy to use, and accepts events as XML data which is pretty much the bread and butter of this trick.

This is a screen shot only. With the actual finished product you can scroll through the months, hyperlink text, display mouse-over text, show holidays, etc.


Here is the code.
-* File anniversary.fex
TABLE FILE EMPDATA
PRINT
     'EMPDATA.EMPDATA.FIRSTNAME'
     'EMPDATA.EMPDATA.LASTNAME'
     'EMPDATA.EMPDATA.HIREDATE'
     COMPUTE HIREDATETIME/HMDYYS = HDTTM(DATECVT(HIREDATE, 'YMD', 'YYMD'), 8, 'HMDYYS'); NOPRINT
     COMPUTE HIREYEAR/I4 = HPART(HIREDATETIME, 'YEAR', 'I4');
     COMPUTE HIREMONTH/I2 = HPART(HIREDATETIME, 'MONTH', 'I2');
     COMPUTE HIREDAY/I2 = HPART(HIREDATETIME, 'DAY', 'I2');
     COMPUTE CUR_DATE/YYMD = &YYMD;
     COMPUTE CUR_DATETIME/HMDYYS = HDTTM(CUR_DATE, 8, 'HMDYYS'); NOPRINT
     COMPUTE CUR_YEAR/I4 = HPART(CUR_DATETIME, 'YEAR', 'I4');
     COMPUTE CUR_MONTH/I2 = HPART(CUR_DATETIME, 'MONTH', 'I2');
     COMPUTE CUR_DAY/I2 = HPART(CUR_DATETIME, 'DAY', 'I2');
     COMPUTE NEXTANNIVERSARY/I8YYMD = IF ( ( HIREMONTH * 100 ) + HIREDAY ) GE ( ( CUR_MONTH * 100 ) + CUR_DAY ) THEN ( ( CUR_YEAR * 10000 ) + ( HIREMONTH * 100 ) + HIREDAY ) ELSE ( ( ( CUR_YEAR * 10000 ) + 10000 ) + ( HIREMONTH * 100 ) + HIREDAY );
     COMPUTE ANNIVERSARY_NUMBER/A3 = FTOA((DATECVT(NEXTANNIVERSARY, 'I8YYMD', 'I4YY') - HIREYEAR),'(D3)','A3');
  COMPUTE YEARTEXT/A5 = IF ANNIVERSARY_NUMBER EQ '  1' THEN 'Year' ELSE 'Years';
ON TABLE HOLD AS HOLDTEMP_ANNIVERSARY FORMAT FOCUS
END

DEFINE FILE HOLDTEMP_ANNIVERSARY
  XML_MONTH/I2 = DATECVT(NEXTANNIVERSARY,'I8YYMD','M');
  XML_DAY/I2 = DATECVT(NEXTANNIVERSARY,'I8YYMD','D');
  XML_YEAR/I4 = DATECVT(NEXTANNIVERSARY,'I8YYMD','YY');
  XML_TEXT/A46 = LCWORD(10,FIRSTNAME,'A10') | ' ' | LCWORD(15,LASTNAME,'A15') | ' ' | ANNIVERSARY_NUMBER | ' ' | YEARTEXT;
  XML_POPUPLINK/A80 = ' ';
  XML_STYLE/A80 = ' ';
  XML_TOOLTIP/A80 = ' ';
  XML_SCRIPT/A80 = ' ';
END

TABLE FILE HOLDTEMP_ANNIVERSARY
PRINT XML_MONTH XML_DAY XML_YEAR XML_TEXT XML_POPUPLINK XML_STYLE XML_TOOLTIP XML_SCRIPT
ON TABLE SAVE
END

APP FI XMLFILE DISK BASEAPP/SCEVENT.XML
-RUN
-WRITE XMLFILE <?xml version="1.0" encoding ="iso-8859-1"?>
-WRITE XMLFILE <events>
-REPEAT BLOCK &LINES TIMES
-READ SAVE &FLD1.2 &FLD2.2 &FLD3.4 &FLD4.46 &FLD5.80 &FLD6.80 &FLD7.80 &FLD8.80
-WRITE XMLFILE <event>
-WRITE XMLFILE <month>&FLD1</month>
-WRITE XMLFILE <day>&FLD2</day>
-WRITE XMLFILE <year>&FLD3</year>
-WRITE XMLFILE <text>&FLD4</text>
-WRITE XMLFILE <popuplink>&FLD5</popuplink>
-WRITE XMLFILE <style>scSmallText</style>
-WRITE XMLFILE <tooltip>&FLD7</tooltip>
-WRITE XMLFILE <script>&FLD8</script>
-WRITE XMLFILE </event>
-BLOCK
-WRITE XMLFILE </events>
-RUN

-HTMLFORM CALENDAR
-EXIT
-*Other
-* Report Painter generated FILEDEF or APP HOLD command
APP HOLD baseapp
-*End Other
  


I am running this out of the BASEAPP folder and have placed the HTML and JS files from ScriptCalendar in the same folder. The code will take the dates and parse them into a XML file SCEVENT.XML which ScriptCalendar reads. DevStudio XML output is not suitable for this method so that is why I create a temp file and read/write the records into an XML file. Once the XML file is set I run calendar.htm using HTMLFORM. Again calendar.htm is the ScriptCalendar file which drives the product and places the XML data into the HTML calendar.

In the past I was really hoping to do all this inside of WebFocus however trying to code tables, placeholders, etc. to form monthly calendars in html and insert data just seemed way to overkill when its much easier to use a more powerful product that is easy to integrate.

Please let me know if you have any questions and I would like to hear of ways this method could be helpful to you.

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


------------------------------------------
DevStudio 8.2.03
WFS 8.2.03
 
Posts: 86 | Location: Atlanta | Registered: May 10, 2007Report This Post
Gold member
posted Hide Post
--reserved--


------------------------------------------
DevStudio 8.2.03
WFS 8.2.03
 
Posts: 86 | Location: Atlanta | Registered: May 10, 2007Report This Post
Expert
posted Hide Post
Thanks trob,
So, who's going to take this as a challenge to do this entirely in WebFOCUS? I will... But, that'll be in my spare time. I just spent an hour on it up to, but not to include the "-HTMLFORM CALENDAR"
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Gold member
posted Hide Post
NP.
I would really like to see that happen, sorry I don't have the time and JS knowledge to do so right now.


------------------------------------------
DevStudio 8.2.03
WFS 8.2.03
 
Posts: 86 | Location: Atlanta | Registered: May 10, 2007Report This Post
Expert
posted Hide Post
trob,
How about providing me with a data, preferably FOCUS DB, and the associated MFD? If so, I'll work on it in my spare time. I'm sure that it'll come in useful for someone.. someday... Besides, I think that "Yes, We Can Do That In WebFOCUS."
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
Doug, Trob,

Here's some code I threw together Wink a while ago to demonstrate creating a calendar on the fly. It could easily be extended to achieve what you wanted. It uses Dialogue Manager to create the code for the months data creation and highlights dates held in the HDAY file specified.

As you can tell from the fex name I have other calendar functions as well as this one.

T

-*******************************************************************************
-* Report Name       : calendar_3.fex
-*
-* Report Description: Produce a calendar output for the current month.
-*
-* Tables Used       :
-*
-* Report Parameters :
-*
-* Written by        : Anthony Alsford EDATA Limited 13/02/2008
-*
-* Amendments        :
-*
-* Notes:
-*
-*******************************************************************************
SET MSG = OFF
-* Identify the holiday file
FILEDEF HDAY DISK \\[your server]\c$\ibi\srv76\wfs\bin\HDAYFSLH.ERR
-* Build a temporary master file for the complete date data
FILEDEF DATEMAS DISK DATERNG.MAS
-RUN
-WRITE DATEMAS FILE=DATERNG,SUFFIX=XFOC
-WRITE DATEMAS SEGNAME=SEG1
-WRITE DATEMAS FIELD=DATE_KEY, ,DMYY ,DMYY , $
-RUN
-* Now create it
CREATE FILE DATERNG
-* and add all possible dates within a month
MODIFY FILE DATERNG
FREEFORM DATE_KEY.A8.
LOG FORMAT MSG OFF
LOG TRANS MSG OFF
LOG INVALID MSG OFF
DATA
-* This repeat loop will ensure at least a whole month is input,
-* Any invalid dates will be rejected.
-DEFAULT &Year  = 2006
-SET &Year  = EDIT(&YYMD,'9999$');
-SET &Mnth = EDIT(&YYMD,'$$$$99$');
-SET &Day   = 1;
-SET &Yearx = &Year;
-REPEAT :Loop1 31 TIMES;
-SET &Date = IF &Day LT 10 THEN '0' || &Day ELSE &Day;
&Date&Mnth&Yearx
-SET &Day = &Day + 1;
-:Loop1
END
-RUN
-*
DEFINE FILE DATERNG
  YEAR/YY       = DATE_KEY;
  MNTH_TTL/MTYY = DATE_KEY;
  DOM/D         = DATE_KEY;
  KEY_YYMD/I8YYMD = DATE_KEY;
-* The day of week (DOW) gives us the column number
-* we require Monday thru Sunday so no change
  DOW/W         = DATE_KEY;
-* and the week no (WNO) gives us the row number - NOTE this is not the ISO week number!!!!
  WNO/I2        = IF DOW EQ 1 THEN LAST WNO + 1 ELSE LAST WNO;
-* The first day of month (FDOM) gives us the offset column to begin the calendar display
  FDOM/W        = DATEMOV(DATE_KEY, 'BOM');
-* DAY_ADJ gives us the ability to line up weeks when used in the single row per month version
  DAY_ADJ/I2 MISSING ON = IF DATE_KEY IS-NOT MISSING THEN (DOM + FDOM - 1) ELSE MISSING;
END
-*
TABLE FILE DATERNG
SUM DOM     AS ''
    COMPUTE WEEKEND/A1 = IF DOW IN (6,7) THEN 'x' ELSE '-'; AS '' NOPRINT
    COMPUTE TODAY/A1   = IF DATE_KEY EQ '&DMYY' THEN 'Y' ELSE ''; NOPRINT
    COMPUTE MNTH_YEAR/MTYY = DATE_KEY; NOPRINT
    COMPUTE HDAY/A1    = IF DECODE KEY_YYMD(HDAY ELSE 'N') NE 'N' THEN 'Y' ELSE ''; NOPRINT
ACROSS DOW AS '' NOPRINT
BY WNO AS '' NOPRINT
HEADING
"<MNTH_TTL"
"M<+0>T<+0>W<+0>T<+0>F<+0>S<+0>S"
-* You could use this as an HTMTABLE
-*ON TABLE HOLD FORMAT HTMTABLE AS CALOBJ
ON TABLE SET HTMLCSS ON
ON TABLE SET PAGE NOLEAD
ON TABLE SET NODATA ''
ON TABLE SET STYLE *
  UNITS=IN, PAGESIZE='A3', LEFTMARGIN=0.2, RIGHTMARGIN=0.2, TOPMARGIN=0.2, BOTTOMMARGIN=0.2,
  SQUEEZE=ON, ORIENTATION=LANDSCAPE, HEADALIGN=BODY, SIZE=9, GRID=ON, $
  TYPE=HEADING, SIZE=10, BORDER=MEDIUM, BORDER-COLOR=RGB(66 66 66),
                BACKCOLOR=RGB(189 190 194), HEADALIGN=BODY, $
  TYPE=HEADING, LINE=1, STYLE=BOLD, JUSTIFY=CENTER, COLSPAN=7, $
  TYPE=HEADING, LINE=2, OBJECT=TEXT, WIDTH=0.15, WRAP=0.15, JUSTIFY=CENTER, $
  TYPE=REPORT, ACROSSCOLUMN=N1, WIDTH=0.15, WRAP=0.15, $
  TYPE=ACROSSVALUE, COLOR=WHITE, $
  TYPE=TITLE, BORDER=LIGHT, BORDER-COLOR=WHITE, $
  TYPE=DATA, ACROSSCOLUMN=N1, JUSTIFY=CENTER, GRID=ON, $
-* Colour code the weekends
  TYPE=DATA, ACROSSCOLUMN=N1, WHEN=HDAY    EQ 'Y', BACKCOLOR=RGB(235 255 230), $
  TYPE=DATA, ACROSSCOLUMN=N1, WHEN=TODAY   EQ 'Y', BACKCOLOR=RGB(255 000 000), BORDER=MEDIUM, COLOR=WHITE, STYLE=BOLD, $
  TYPE=DATA, ACROSSCOLUMN=N1, WHEN=WEEKEND EQ 'x', BACKCOLOR=RGB(215 220 255), $
  TYPE=DATA, ACROSSCOLUMN=N1, WHEN=WEEKEND EQ '-', BACKCOLOR=RGB(230 235 255), $
ENDSTYLE
END

This message has been edited. Last edited by: Tony A,



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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Expert
posted Hide Post
Thanks, That's Great Tony.
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report 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     [How To] Output data from Webfocus into a HTML Calendar

Copyright © 1996-2020 Information Builders