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.
I know there are many posts about tables and alternating colors. I've read several, but I've not yet stumbled across the one that might answer my question. Of course, I might be overlooking the obvious answer.
I have numerous tables on my portal, all of which rely upon a stylesheet to alternate the colors for every row of data. What I've found is that if one of my nine categories is missing from a particular store, the colors are out of order for the next store. I want to force the alternating colors to always stay in the proper order. Here's a list of categories and the preferred order for my tables.
Grocery - White Floral - Yellow Deli - White Coffee Shop - Yellow Pharmacy - White Health and Beauty - Yellow Pet Food and Supplies - White Automotive - Yellow Toys - White Total Formatted a different way
I read several posts about forcing colors, many of which discuss the subtotal and total features of AppStudio. I am not using the subtotal and total features due to the small-cell protection procedure we use to protect some of our data. I'm not sure, but it appears as if it might be affecting the alternating colors.
What happens when a category is missing is that the alternating of the colors gets out of order for the next store. So, while the order might be correct for the store above it, the second store is off in terms of its color like this:
This is the first store, and it's correct in terms of the colors.
Grocery - White Floral - Yellow Deli - White Coffee Shop - Yellow Pharmacy - White Health and Beauty - Yellow Pet Food and Supplies - White Automotive - Yellow Total Formatted a different way
This is the second store, and it's incorrect in terms of the colors. It picks up from the previous store's colors and does not correct itself even though this store has all nine categories.
Grocery - Yellow - s/be White Floral - White s/be Yellow Deli - Yellow s/be White Coffee Shop - White s/be Yellow Pharmacy - Yellow s/be White Health and Beauty - White s/be Yellow Pet Food and Supplies - Yellow s/be White Automotive - White s/be Yellow Toys - Yellow s/be White Total Formatted a different way
I might have overlooked a way to force the proper alternating pattern of colors in some of the forum posts. I saw some posts about subtotals and totals, but an important distinction I'd like to note about my tables is that we do not use subtotal and total features due to the small cell procedures we have to use to protect data on our public-facing portal. We have create them different ways as you'll see in the table code (immediately below).
-* EXTRACT SOURCE DATA
DEFINE FILE DEPARTMENTS
QSET/I4 = EDIT(SALES_YEAR);
YR /YY = QSET;
SORT_DEPT/A46 = IF DEPT_NAME EQ 'Grocery' THEN ' Grocery' ELSE
IF DEPT_NAME EQ 'Floral' THEN ' Floral' ELSE
IF DEPT_NAME EQ 'Deli' THEN ' Deli' ELSE
IF DEPT_NAME EQ 'Coffee Shop' THEN ' Coffee Shop' ELSE
IF DEPT_NAME EQ 'Pharmacy' THEN ' Pharmacy' ELSE
IF DEPT_NAME EQ 'Health and Beauty' THEN ' Health and Beauty' ELSE
IF DEPT_NAME EQ 'Pet Food and Supplies' THEN ' Pet Food and Supplies' ELSE
IF DEPT_NAME EQ 'Automotive' THEN ' Automotive' ELSE
IF DEPT_NAME EQ 'Toys' THEN ' Toys' ELSE
IF DEPT_NAME EQ 'Total' THEN 'Total' ELSE DEPT_NAME ;
END
-SET &MAXYR = &YR;
-SET &MINYR = &MAXYR-5;
TABLE FILE DEPARTMENTS
-* SET values for small protect processing and -INCLUDE.
-* Some choices are optional.
-*INCLUDE small_cell_protect_5
-*-----------------------------------------------------------------------------------------------
SUM
SUM.DEPARTMENTS.DEPARTMENTS.EMPLOYEES AS 'SC_COUNTS'
BY DEPARTMENTS.DEPARTMENTS.STORE_NAME
BY DEPARTMENTS.DEPARTMENTS.SALES_YEAR
BY DEPARTMENTS.DEPARTMENTS.YR
BY LOWEST DEPARTMENTS.DEPARTMENTS.SORT_DEPT
WHERE ( DEPARTMENTS.DEPARTMENTS.QUARTER_NAME EQ 'First Quarter' )
WHERE (DEPARTMENTS.DEPARTMENTS.YR GE &MINYR);
WHERE (DEPARTMENTS.DEPARTMENTS.YR LE &MAXYR);
ON TABLE HOLD AS EXTDATA FORMAT FOCUS
END
-RUN
-* EXTRACT MAXIMUM YEAR IN A VARIABLE
-DEFAULTH &YRMAX = 0
TABLE FILE EXTDATA
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 EXTDATA
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 EXTDATA
SALES_YEAR/A100 =EDIT(YR)
END
TABLE FILE EXTDATA
SUM
SC_COUNTS
BY STORE_NAME
BY SALES_YEAR
BY LOWEST SORT_DEPT
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE HOLD AS REPINPUT
ON TABLE SET STYLE *
ENDSTYLE
END
-* SET values for small protect processing and -INCLUDE.
-* Some choices are optional.
-SET &input = 'repinput';
-SET &output = 'finaldata';
-SET &dim1 = 'SORT_NAME';
-SET &dim1_id = 'SORT_DEPT';
-SET &dim2 = 'SALES_YEAR';
-SET &measure = 'SC_COUNTS';
-*Include small-cell protection file here
-* Create report based on small protect output.
DEFINE FILE finaldata
SORT_REGION/A2V = IF &dim1 LIKE '%Julie%' THEN '2' ELSE
IF &dim1 LIKE '%Lisa%' THEN '4' ELSE
IF &dim1 LIKE '%Jake%' THEN '3' ELSE '1' ;
END
TABLE FILE finaldata
ON TABLE SUBHEAD
"Stores"
"Employees by Department"
"Sales Years &MINYR - &MAXYR"
"Store Listing"
ON TABLE SUBFOOT
"Source: Sales Data "
" "
"^ Indicates a cell has been marked for small-cell protection."
SUM &measure
BY SORT_REGION NOPRINT
BY &dim1._SORT NOPRINT
BY &dim1 AS 'Store'
BY LOWEST &dim1_id AS 'Department'
ACROSS &dim2 AS 'First Quarter'
WHERE &dim2 NE 'Total' AND &dim1 NE 'Total'
ON &dim1 SUBFOOT
" "
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 *
-INCLUDE STYLESHEET file here
$
TYPE=REPORT,
HFREEZE=TOP,
$
TYPE=TITLE,
BORDER-BOTTOM=ON,
BORDER-BOTTOM-COLOR=RGB (0 58 99),
$
TYPE=TITLE,
COLUMN=N3,
JUSTIFY=LEFT,
BORDER-BOTTOM=ON,
BORDER-BOTTOM-COLOR=RGB (0 58 99),
$
TYPE=TITLE,
COLUMN=N4,
JUSTIFY=LEFT,
BORDER-BOTTOM=ON,
BORDER-BOTTOM-COLOR=RGB (0 58 99),
$
TYPE=ACROSSVALUE,
JUSTIFY=CENTER,
WRAP=ON,
$
TYPE=DATA,
JUSTIFY=CENTER,
$
TYPE=DATA,
COLUMN=N3,
JUSTIFY=LEFT,
SQUEEZE=ON,
$
TYPE=DATA,
COLUMN=N4,
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,
OBJECT=TEXT,
ITEM=1,
SIZE=9,
STYLE=NORMAL,
$
TYPE=TABFOOTING,
LINE=3,
OBJECT=TEXT,
ITEM=1,
SIZE=9,
STYLE=ITALIC,
$
TYPE=SUBFOOT
BORDER-BOTTOM=ON,
BORDER-TOP=ON,
$
TYPE=SUBFOOT
BORDER-BOTTOM=LIGHT,
BORDER-TOP=LIGHT,
$
TYPE=DATA,
COLUMN=N12,
BORDER-LEFT=LIGHT,
BORDER-LEFT-COLOR=RGB(0 58 99),
$
TYPE=ACROSSVALUE,
COLUMN=N12,
BORDER-LEFT=LIGHT,
BORDER-LEFT-COLOR=RGB(0 58 99),
$
TYPE=DATA, WHEN = &dim1_id EQ 'Total', COLOR=RGB(255 226 146), STYLE=NORMAL, $
TYPE=DATA, WHEN = &dim1_id EQ 'Total', BACKCOLOR=RGB(0 58 99), STYLE=NORMAL, $
TYPE=DATA, WHEN = &dim1_id EQ 'Total', BORDER-BOTTOM=LIGHT, BORDER-BOTTOM-COLOR=RGB(0 58 99),$
TYPE=DATA, WHEN = &dim1_id EQ 'Total', BORDER-BOTTOM=LIGHT, BORDER-BOTTOM-COLOR=RGB(0 58 99),$
ENDSTYLE
END
-RUN
DEFINE FILE CAR
DSPYEL /A1 = IF COUNTRY EQ 'FRANCE' OR 'JAPAN' THEN 'Y' ELSE 'N';
END
TABLE FILE CAR
SUM SEATS
DSPYEL NOPRINT
BY COUNTRY
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
DEFMACRO=BACKYELLOW,
MACTYPE=RULE,
WHEN=DSPYEL EQ 'Y',
$
TYPE=DATA,
BACKCOLOR=RGB(255 255 255),
JUSTIFY=CENTER,
$
TYPE=DATA,
BACKCOLOR=RGB(255 243 209),
JUSTIFY=CENTER,
MACRO=BACKYELLOW,
$
ENDSTYLE
END
The DEFINE will include all categories that you want to be yellow
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
Thank you both for the replies. I tried Martin's, and while it worked for the question I asked (and I learned a new technique), it didn't address what I really need (I didn't ask my question right).
If a category is missing, either one of these solutions will not adjust the coloring properly for that particular store. So, if one of the categories is missing, it will leave out the yellow and then end up with two white rows. Is there a way to make the color adjust appropriately?
That's a good question about the sample sources. I'll look for them and see if I can replicate it there. I might also just try to upload a simple Excel file. It shows the issue clearly.
Automatic color alternate should manage that by itself.
But you've requested to keep the categories the same color which my sample is doing
Grocery - White
Floral - Yellow
Deli - White
Coffee Shop - Yellow
Pharmacy - White
Health and Beauty - Yellow
Pet Food and Supplies - White
Automotive - Yellow
Toys - White
So what you are saying that you donSo, You would like to have the color "reset" ? But what for the next region ? Back to the original color pattern or continue the pattern as is with the automatic color alternate ?
Fixed color alternate per "type"
DEFINE FILE GGSALES
DSPYEL /A1 = IF PRODUCT EQ 'Capuccino' OR 'Coffee Pot' OR 'Espresso' OR 'Mug' OR 'Thermos' THEN 'Y' ELSE 'N';
END
TABLE FILE GGSALES
SUM DOLLARS
DSPYEL NOPRINT
BY REGION
BY PRODUCT
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
DEFMACRO=BACKYELLOW,
MACTYPE=RULE,
WHEN=DSPYEL EQ 'Y',
$
TYPE=DATA,
BACKCOLOR=RGB(255 255 255),
JUSTIFY=CENTER,
$
TYPE=DATA,
BACKCOLOR=RGB(255 243 209),
JUSTIFY=CENTER,
MACRO=BACKYELLOW,
$
ENDSTYLE
END
Automatic color alternate
TABLE FILE GGSALES
SUM DOLLARS
BY REGION
BY PRODUCT
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
TYPE=DATA,
BACKCOLOR=(RGB(255 255 255) RGB(255 243 209)),
JUSTIFY=CENTER,
$
ENDSTYLE
END
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
Yes, Martin, that was my original question and in my reply, I admitted I didn't ask my question correctly. I will try the method you just outlined for me, but it might be tomorrow. Thanks so much!
First, I want to say thank you again for all your suggestions on this post and some of my other posts in the past. I have learned so much from you that I have used on my portal.
As far as this post, I tried your latest suggestion. Although it alternates the colors nicely and I've learned another new trick, it still didn't address my business challenge in full, something my users would really like to see.
I want the color scheme to start over with each new store. Is that even possible?
So, what I'm saying is this: If the first store has nine categories, the color scheme will be perfect. If the second store has six categories, the suggestion you provided alternates the colors, but it does not start the scheme over from scratch. I wonder if it has something to do with the code I posted at the beginning.
You'll note I use both a subhead and subfoot. There is an extra white line between stores. Every time the store name changes, I truly want the color scheme to start over from the beginning. The white line serves as a divider, and the totals are custom formatted in blue. Is it possible to start the color scheme over at each store?
Sure it is possible. Instead of using the categories as the pattern indicator (as per my sample with the define) use a row indicator. Meaning that for each row from a store set a number to it (rowid) no matter the category and then use the rowid in the define to set the color. But you will need one more step
TABLE FILE GGSALES
SUM DOLLARS
BY REGION
BY TOTAL COMPUTE ROWID /I2 = IF REGION EQ LAST REGION THEN ROWID + 1 ELSE 1;
BY PRODUCT
ON TABLE HOLD AS EXTDATA
END
-RUN
DEFINE FILE EXTDATA
-*-* FOR EACH EVEN ROW, THE COLOR WILL CHANGE
DSPYEL /A1 = IF IMOD(ROWID, 2, 'I2') EQ 0 THEN 'Y' ELSE 'N';
END
TABLE FILE EXTDATA
SUM DOLLARS
DSPYEL NOPRINT
BY REGION
ON REGION SUBHEAD
""
BY PRODUCT
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
DEFMACRO=BACKYELLOW,
MACTYPE=RULE,
WHEN=DSPYEL EQ 'Y',
$
TYPE=DATA,
BACKCOLOR=RGB(255 255 255),
JUSTIFY=CENTER,
$
TYPE=DATA,
BACKCOLOR=RGB(255 243 209),
JUSTIFY=CENTER,
MACRO=BACKYELLOW,
$
ENDSTYLE
END
-RUN
Using the above you will see the difference with my previous sample (Fixed color alternate per "type") where for Midwest the first two rows had a blank background
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
Primed by Martin, you can do this in a single pass -
TABLE FILE GGSALES
SUM DOLLARS
BY REGION
BY TOTAL COMPUTE ROWID /I2 = IF REGION EQ LAST REGION THEN ROWID ELSE ABS(LAST ROWID - 1); NOPRINT
BY PRODUCT
ON TABLE SET STYLE *
TYPE=DATA,
BACKCOLOR=RGB(255 255 255),
JUSTIFY=CENTER, WHEN=ROWID EQ 0,
$
TYPE=DATA,
BACKCOLOR=RGB(255 243 209),
JUSTIFY=CENTER, WHEN=ROWID NE 0,
$
ENDSTYLE
END
-RUN
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
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
It's an old habit that I have to always first extract the data that I need to produce the report and have the latest step (report display) with as less as possible of data manipulation. But yes, when your source data allows you to perform in one step, why not.
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