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.
Business challenge: To add a row coded in blue with yellow text above a table based on region and store name. The row should look like this:
2013 2014 2015 2016 2017 2018
Region
Southwest
or
2013 2014 2015 2016 2017 2018
Store
Jake's
The look is dependent on whether a selection is made in the dropdown box that feeds the parameter or whether a specific store is selected from the dropdown list.
Here is my code:
-IF &STORE EQ '_FOC_NULL' THEN GOTO ALL ELSE GOTO STORE;
-ALL
-* EXTRACT SOURCE DATA
DEFINE FILE SALES_DATA
SALESTERMSET/I4 = EDIT(SALES_YEAR);
YR /YY = SALESTERMSET;
END
-SET &MAXYR = &YR;
-SET &MINYR = &MAXYR-5;
TABLE FILE SALES_DATA
SUM
SALES_DATA.SALES_DATA.EMPCOUNT
SALES_DATA.SALES_DATA.SALES_HOURS
COMPUTE EXEMPT/D12 = IF SALES_DATA.SALES_DATA.CODE EQ 'E' THEN
SALES_DATA.SALES_DATA.SALES_HOURS / 80 ELSE
SALES_DATA.SALES_DATA.SALES_HOURS / 60;
BY LOWEST SALES_DATA.SALES_DATA.YR
BY LOWEST SALES_DATA.SALES_DATA.CODE
WHERE ( SALES_DATA.SALES_DATA.REPORT_TERM_NAME EQ 'Sales Year' )
WHERE SALES_DATA.SALES_DATA.SECTOR_NAME EQ 'Southwest Region'
WHERE (SALES_DATA.SALES_DATA.YR GE &MINYR);
WHERE (SALES_DATA.SALES_DATA.YR LE &MAXYR);
ON TABLE HOLD AS REGHOLD FORMAT FOCUS
-*ON TABLE PCHOLD FORMAT HTML
END
-RUN
-* EXTRACT MAXIMUM YEAR IN A VARIABLE
-DEFAULTH &YRMAX = 0
TABLE FILE REGHOLD
SUM MAX.YR/I4 AS 'YRMAX'
ON TABLE HOLD AS MAXYR FORMAT BINARY
END
-RUN
-READFILE MAXYR
-SET &YRMAX = &YRMAX;
-TYPE &YRMAX
-* EXTRACT ALL INDIVIDUAL YEARS IN A VARIABLE
-DEFAULTH &EXTYR = 0
TABLE FILE REGHOLD
BY YR/I4 AS 'EXTYR'
ON TABLE HOLD AS YRLIST FORMAT BINARY
END
-RUN
-SET &NBYR = &LINES;
-REPEAT READYR FOR &I FROM 1 TO &NBYR STEP 1
-DEFAULTH &YR.&I = 0
-READFILE YRLIST
-SET &YR.&I = &EXTYR;
-TYPE &YR.&I
-READYR
DEFINE FILE REGHOLD
SALES_YEAR/A100 =EDIT(YR)
END
TABLE FILE REGHOLD
SUM
EMPCOUNT/D12 AS 'EMPCOUNT' OVER
EXEMPT AS 'Exempt Employees' OVER
SALES_HOURS/D12 AS 'Total Sales Hours'
ACROSS SALES_YEAR AS 'Sales Year'
ON TABLE SUBHEAD
"Julie's Stores"
"Employee Counts, Exempt Employees and Sales Hours"
"Sales Years &MINYR - &MAXYR"
"All Southwest Stores"
ON TABLE SUBFOOT
"Source: Sales Records"
" "
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE PCHOLD FORMAT &WFFMT.(<HTML Web Document (HTML),HTML>,<Excel XLSX (XLSX),XLSX>).Output type.
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
TYPE=REPORT, TITLETEXT='WebFOCUS Report', ORIENTATION=LANDSCAPE, $
TYPE=FOOTING, LINE=1, ITEM=1, OBJECT=TEXT, JUSTIFY=RIGHT, FONT='Calibri', SIZE=9, COLOR=RGB(0 0 0), STYLE=NORMAL, $
TYPE=FOOTING, JUSTIFY=RIGHT, FONT='Calibri', SIZE=9, COLOR=RGB(0 0 0), STYLE=ITALIC,
$
TYPE=REPORT,
HFREEZE=TOP,
$
TYPE=ACROSSVALUE,
JUSTIFY=CENTER,
WRAP=ON,
$
TYPE=ACROSSVALUE
BACKCOLOR=(RGB(255 243 209)),
COLOR=RGB(0 0 0),
$
TYPE=TITLE,
COLUMN=EMPCOUNT,
BACKCOLOR=(RGB(255 255 255)),
COLOR=RGB(0 0 0),
$
TYPE=TITLE,
COLUMN=EXEMPT,
BACKCOLOR=(RGB(255 243 209) ),
COLOR=RGB(0 0 0),
$
TYPE=TITLE,
COLUMN=SALES_HOURS,
BACKCOLOR=(RGB(255 255 255)),
COLOR=RGB(0 0 0),
$
TYPE=DATA,
BACKCOLOR=(RGB(255 255 255)),
$
TYPE=DATA,
ACROSSCOLUMN=N2,
BACKCOLOR=(RGB(255 243 209) ),
$
TYPE=DATA,
COLUMN=EXEMPT,
BACKCOLOR=(RGB(255 243 209) ),
$
TYPE=DATA,
JUSTIFY=CENTER,
$
TYPE=DATA,
COLUMN=N2,
JUSTIFY=LEFT,
SQUEEZE=ON,
$
TYPE=DATA,
COLUMN=N3,
JUSTIFY=LEFT,
$
TYPE=DATA,
BORDER-TOP=OFF,
BORDER-BOTTOM=OFF,
$
TYPE=TABFOOTING,
BORDER-TOP=OFF,
$
TYPE=TABFOOTING,
LINE=1,
JUSTIFY=RIGHT,
$
TYPE=TABFOOTING,
LINE=1,
OBJECT=TEXT,
ITEM=1,
SIZE=9,
STYLE=NORMAL,
$
TYPE=TABFOOTING,
LINE=2,
STYLE=ITALIC,
$
TYPE=TABFOOTING,
LINE=3,
STYLE=ITALIC,
$
TYPE=TABFOOTING,
LINE=4,
STYLE=ITALIC,
$
TYPE=TABFOOTING,
LINE=5,
STYLE=ITALIC,
$
ENDSTYLE
END
-RUN
-GOTO LBL_END;
-STORE
-* EXTRACT SOURCE DATA
DEFINE FILE SALES_DATA
TERMSET/I4 = EDIT(SALES_YEAR);
YR /YY = TERMSET;
END
-SET &MAXYR = &YR;
-SET &MINYR = &MAXYR-5;
TABLE FILE SALES_DATA
SUM
SALES_DATA.SALES_DATA.EMPCOUNT
SALES_DATA.SALES_DATA.SALES_HOURS
COMPUTE EXEMPT/D12 = IF SALES_DATA.SALES_DATA.CODE EQ 'U' THEN
SALES_DATA.SALES_DATA.SALES_HOURS / 30 ELSE
SALES_DATA.SALES_DATA.SALES_HOURS / 24;
BY LOWEST SALES_DATA.SALES_DATA.YR
BY LOWEST SALES_DATA.SALES_DATA.CODE
WHERE ( SALES_DATA.SALES_DATA.SALES_PERIOD EQ 'Sales Year' )
WHERE ( SALES_DATA.SALES_DATA.REGION EQ '®ION.(<Southwest,Southwest>).Region:.' );
WHERE ( SALES_DATA.SALES_DATA.STORE EQ '&STORE.(FIND SALES_DATA.SALES_DATA.STORE IN SALES_DATA).STORE:.' );
WHERE (SALES_DATA.SALES_DATA.YR GE &MINYR);
WHERE (SALES_DATA.SALES_DATA.YR LE &MAXYR);
ON TABLE HOLD AS REGHOLD FORMAT FOCUS
-*ON TABLE PCHOLD FORMAT HTML
END
-RUN
-* EXTRACT MAXIMUM YEAR IN A VARIABLE
-DEFAULTH &YRMAX = 0
TABLE FILE REGHOLD
SUM MAX.YR/I4 AS 'YRMAX'
ON TABLE HOLD AS MAXYR FORMAT BINARY
END
-RUN
-READFILE MAXYR
-SET &YRMAX = &YRMAX;
-TYPE &YRMAX
-* EXTRACT ALL INDIVIDUAL YEARS IN A VARIABLE
-DEFAULTH &EXTYR = 0
TABLE FILE REGHOLD
BY YR/I4 AS 'EXTYR'
ON TABLE HOLD AS YRLIST FORMAT BINARY
END
-RUN
-SET &NBYR = &LINES;
-REPEAT READYR FOR &I FROM 1 TO &NBYR STEP 1
-DEFAULTH &YR.&I = 0
-READFILE YRLIST
-SET &YR.&I = &EXTYR;
-TYPE &YR.&I
-READYR
DEFINE FILE REGHOLD
SALES_YEAR/A100 =EDIT(YR)
END
TABLE FILE REGHOLD
SUM
EMPCOUNT/D12 AS 'EMPCOUNT' OVER
EXEMPT AS 'Full-Time Equivalency' OVER
SALES_HOURS/D12 AS 'Total Credit Hours'
ACROSS SALES_YEAR AS 'Academic Year'
ON TABLE SUBHEAD
"Julie's Stores"
"Employee Counts, Exempt Employees and Sales Hours"
"Sales Years &MINYR - &MAXYR"
"&STORE"
ON TABLE SUBFOOT
"Source: Sales Records "
" "
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE PCHOLD FORMAT &WFFMT.(<HTML Web Document (HTML),HTML>,<Excel XLSX (XLSX),XLSX>).Output type.
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
TYPE=REPORT, TITLETEXT='WebFOCUS Report', ORIENTATION=LANDSCAPE, $
TYPE=FOOTING, LINE=1, ITEM=1, OBJECT=TEXT, JUSTIFY=RIGHT, FONT='Calibri', SIZE=9, COLOR=RGB(0 0 0), STYLE=NORMAL, $
TYPE=FOOTING, JUSTIFY=RIGHT, FONT='Calibri', SIZE=9, COLOR=RGB(0 0 0), STYLE=ITALIC,
$
TYPE=REPORT,
HFREEZE=TOP,
$
TYPE=ACROSSVALUE,
JUSTIFY=CENTER,
WRAP=ON,
$
TYPE=ACROSSVALUE
BACKCOLOR=(RGB(255 243 209)),
COLOR=RGB(0 0 0),
$
TYPE=TITLE,
COLUMN=EMPCOUNT,
BACKCOLOR=(RGB(255 255 255)),
COLOR=RGB(0 0 0),
$
TYPE=TITLE,
COLUMN=EXEMPT,
BACKCOLOR=(RGB(255 243 209) ),
COLOR=RGB(0 0 0),
$
TYPE=TITLE,
COLUMN=SALES_HOURS,
BACKCOLOR=(RGB(255 255 255)),
COLOR=RGB(0 0 0),
$
TYPE=DATA,
BACKCOLOR=(RGB(255 255 255)),
$
TYPE=DATA,
ACROSSCOLUMN=N2,
BACKCOLOR=(RGB(255 243 209) ),
$
TYPE=DATA,
COLUMN=EXEMPT,
BACKCOLOR=(RGB(255 243 209) ),
$
TYPE=DATA,
JUSTIFY=CENTER,
$
TYPE=DATA,
COLUMN=N2,
JUSTIFY=LEFT,
SQUEEZE=ON,
$
TYPE=DATA,
COLUMN=N3,
JUSTIFY=LEFT,
$
TYPE=DATA,
BORDER-TOP=OFF,
BORDER-BOTTOM=OFF,
$
TYPE=TABFOOTING,
BORDER-TOP=OFF,
$
TYPE=TABFOOTING,
LINE=1,
JUSTIFY=RIGHT,
$
TYPE=TABFOOTING,
LINE=1,
OBJECT=TEXT,
ITEM=1,
SIZE=9,
STYLE=NORMAL,
$
TYPE=TABFOOTING,
LINE=2,
STYLE=ITALIC,
$
TYPE=TABFOOTING,
LINE=3,
STYLE=ITALIC,
$
TYPE=TABFOOTING,
LINE=4,
STYLE=ITALIC,
$
TYPE=TABFOOTING,
LINE=5,
STYLE=ITALIC,
$
ENDSTYLE
END
-RUN
-LBL_END;
This message has been edited. Last edited by: FP Mod Chuck,
You can use MACRO feature to perform conditional styling. But have your default styling first defined prior to the MACROed one.
-* Macro definition
DEFMACRO=<MACRONAME>,
MACTYPE=RULE,
WHEN=<test condition>,
$
-* To style across title
TYPE=ACROSSTITLE,
COLOR=RGB(8 97 74),
BACKCOLOR=RGB(242 180 87),
MACRO=<macroname>,
$
-* To style across value
TYPE=ACROSSVALUE,
COLOR=RGB(8 97 74),
BACKCOLOR=RGB(242 180 87),
MACRO=<macroname>,
$
-* To style data under the across
TYPE=DATA,
ACROSSCOLUMN=<column>,
COLOR=RGB(8 97 74),
BACKCOLOR=RGB(242 180 87),
MACRO=<macroname>,
$
This message has been edited. Last edited by: MartinY,
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013