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 have been searching for a way to make a column heading dynamic depending on the value of a field. Although I've seen a lot of interesting things during my investigation, I still can't find how to do what I'm after.
To illustrate, I've made a simple report from the car file:
DEFINE FILE GA_CAR ISLAND_NATION/A5= IF GA_CAR.ORIGIN.COUNTRY EQ 'JAPAN' THEN 'TRUE' ELSE 'FALSE'; END TABLE FILE GA_CAR SUM GA_CAR.BODY.DEALER_COST NOPRINT AS 'Dealer Alloc' GA_CAR.BODY.RETAIL_COST NOPRINT AS 'Retail Alloc' COMPUTE COST_ALLOCATION/D12.3 = IF GA_CAR.ORIGIN.ISLAND_NATION EQ 'TRUE' THEN GA_CAR.BODY.DEALER_COST /1000 ELSE GA_CAR.BODY.RETAIL_COST / 1000; BY GA_CAR.ORIGIN.ISLAND_NATION NOPRINT BY LOWEST GA_CAR.ORIGIN.COUNTRY BY LOWEST GA_CAR.COMP.CAR ACROSS LOWEST GA_CAR.BODY.BODYTYPE
ON GA_CAR.ORIGIN.ISLAND_NATION PAGE-BREAK ON TABLE SET PAGE-NUM NOLEAD ON TABLE NOTOTAL ON TABLE PCHOLD FORMAT HTML ON TABLE SET HTMLCSS ON ON TABLE SET STYLE * INCLUDE = IBFS:/CFG/FILE/IBI_HTML_DIR/javaassist/intl/EN/combine_templates/ENria_ocean_rounded_theme.sty, $ TYPE=ACROSSVALUE, ACROSS=1, BACKCOLOR='WHITE', $ ENDSTYLE END
In this made up example, what I would like is for the COST_ALLOCATION compute that is shown in the report to have a column title that is either "Dealer Alloc" or "Retail Alloc" depending on the value in the ISLAND_NATION define field.
I've seen techniques to turn the "NOPRINT" on or off (for the hidden columns), but it requires an & variable, so that doesn't seem like an option. I've tried a number of different things to see if the "AS" name can be made dynamic, but nothing has worked so far.
This seems to me it should be a simple thing. Does anyone know if this is possible?
Thanks, ChrisThis message has been edited. Last edited by: BC_Chris,
That looks like good information to have. However, I don't think I can use that technique because I have an across, and I'm not going to be able to tell how many columns I'm going to need. Or is there a way to tell that before hand and then set up a loop to build the heading?
Unless I don't understand, I don't think your sample code will get you closer to what you want: ISLAND_NATION is a BY column which means when you have a ACROSS report, the ACROSS columns will be containing data for both types of ISLAND NATIONs (TRUE and FALSE), hence the ACROSS column title cannot be fixed to one or the other.
Since ISLAND_NATION is TRUE for JAPAN, you would like the title of the last column to be Dealer Alloc, but there is also data for FRANCE, ITALY, etc...
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
My apologies, when I tried to recreate my real world problem using the car file, I left out one important piece:
ON GA_CAR.ORIGIN.ISLAND_NATION PAGE-BREAK
I would like the across columns on the page that Japan is on to be titled "Dealer Alloc" and the other countries on the other page would be titled "Retail Alloc."
I had not tried compound report because I'm very new and didn't know about it. But I looked up some info on how to do it, and it looks like that is probably my best option.
Forgive me for a subject segue, but what is the difference between a compound report and a compound document? Dev Studio (GUI not Text) has the button to build a document, but it seems that only has PDF as the option... I just typed in text to get the compound report set up.
Or is there a way to tell that before hand and then set up a loop to build the heading
Yes, there is a way.
TABLE FILE CAR
BY BODYTYPE
ON TABLE HOLD
END
-RUN
-SET &COLS=&LINES;
Applying this and the link I showed:
-* File chris2.fex
DEFINE FILE CAR
ISLAND_NATION/A5= IF CAR.ORIGIN.COUNTRY EQ 'JAPAN' THEN 'TRUE'
ELSE 'FALSE';
TF1/A12 =IF ISLAND_NATION EQ 'TRUE' THEN 'Dealer Alloc' ELSE 'Retail Alloc';
END
-RUN
TABLE FILE CAR
BY BODYTYPE
ON TABLE SAVE
END
-RUN
-SET &COLS=&LINES;
-SET &HEAD='Country<+0>Car<+0>';
-REPEAT #TITLES FOR &I FROM 1 TO &COLS;
-SET &HEAD=&HEAD || '<TF1' ;
-#TITLES
-RUN
TABLE FILE CAR
HEADING
"&HEAD"
SUM
COMPUTE COST_ALLOCATION/D12.3 = IF ISLAND_NATION EQ 'TRUE' THEN CAR.BODY.DEALER_COST /1000
ELSE CAR.BODY.RETAIL_COST / 1000; AS ''
BY ISLAND_NATION NOPRINT PAGE-BREAK
BY TF1 NOPRINT
BY LOWEST CAR.ORIGIN.COUNTRY AS ''
BY LOWEST CAR.COMP.CAR AS ''
ACROSS LOWEST CAR.BODY.BODYTYPE NOPRINT
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = ENDEFLT,
$
TYPE=ACROSSVALUE,
ACROSS=1,
BACKCOLOR='WHITE',
$
TYPE=HEADING, HEADALIGN=BODY,$
ENDSTYLE
END
This message has been edited. Last edited by: Danny-SRL,
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006