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] Conditional BY fields in a report

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Conditional BY fields in a report
 Login/Join
 
Member
posted
I have a need for the user to be able to select a variable number of BY fields. They might need 1 level, 2 levels, 3 levels, etc. If they only select values for the first variable then the report needs only 1 BY if they select 2 then the report needs 2 BY columns, etc. Below is a sample .fex but they would need to select values for all three variables.

-* Default Mode: Report Painter

-SET &CNT1 = &CTR.(MODEL,CAR,COUNTRY).CNT1.;
-SET &CNT2 = &CTR1.(MODEL,CAR,COUNTRY).CNT2.;
-SET &CNT3 = &CTR2.(MODEL,CAR,COUNTRY).CNT3.;

SET EXPANDBYROW = ON
TABLE FILE CAR
SUM
CAR.BODY.DEALER_COST
CAR.BODY.RETAIL_COST
BY &CNT1
BY &CNT2
BY &CNT3
ON TABLE SET EXPANDABLE ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
ENDSTYLE
END

I've searched the forum and cannot find a solution.

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 8009, All Outputs
 
Posts: 26 | Registered: February 28, 2013Report This Post
Expert
posted Hide Post
  
-DEFAULTS &CNT1 = 'FOC_NONE', &CNT2 = 'FOC_NONE', &CNT3 = 'FOC_NONE'
-PROMPT &CNT1.(<NONE,FOC_NONE>,<MODEL,MODEL>,<CAR,CAR>,<COUNTRY,COUNTRY>.Select Sort 1.
-PROMPT &CNT2.(<NONE,FOC_NONE>,<MODEL,MODEL>,<CAR,CAR>,<COUNTRY,COUNTRY>.Select Sort 2.
-PROMPT &CNT3.(<NONE,FOC_NONE>,<MODEL,MODEL>,<CAR,CAR>,<COUNTRY,COUNTRY>.Select Sort 3.
-SET &SORT1 = IF &CNT1 NE 'FOC_NONE' THEN 'BY ' | &CNT1 ELSE '';
-SET &SORT2 = IF &CNT2 NE 'FOC_NONE' THEN 'BY ' | &CNT2 ELSE '';
-SET &SORT3 = IF &CNT3 NE 'FOC_NONE' THEN 'BY ' | &CNT3 ELSE '';

SET EXPANDBYROW = ON
TABLE FILE CAR
SUM
CAR.BODY.DEALER_COST
CAR.BODY.RETAIL_COST
&SORT1
&SORT2
&SORT3
ON TABLE SET EXPANDABLE ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
ENDSTYLE
END
-EXIT 


Not tested, we don't use -PROMPT, we use HTML


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Member
posted Hide Post
That will work, Thanks for the quick response.


WebFOCUS 8009, All Outputs
 
Posts: 26 | Registered: February 28, 2013Report This Post
Virtuoso
posted Hide Post
  
-PROMPT &CNT1.(<NONE,FOC_NONE>,<MODEL,MODEL>,<CAR,CAR>,<COUNTRY,COUNTRY>.Select Sort 1.
-PROMPT &CNT2.(<NONE,FOC_NONE>,<MODEL,MODEL>,<CAR,CAR>,<COUNTRY,COUNTRY>.Select Sort 2.
-PROMPT &CNT3.(<NONE,FOC_NONE>,<MODEL,MODEL>,<CAR,CAR>,<COUNTRY,COUNTRY>.Select Sort 3.

SET EXPANDBYROW = ON
TABLE FILE CAR
SUM
CAR.BODY.DEALER_COST
CAR.BODY.RETAIL_COST
BY &CNT1
BY &CNT2
BY &CNT3
ON TABLE SET EXPANDABLE ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
ENDSTYLE
END

When WF replaces the paramters with their values, the lines with BY FOC_NONE will not be placed in the FOCSTACK. Hence the simplicity.


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, 2006Report This Post
Platinum Member
posted Hide Post
The easiest way to do this is in DevStudio.
You first put any number of BY fields on the canvas, then multi-select them, and depress the
button next to the WHERE/IF. It asks for some options and all the coding is done for you.


Release 7.6.9
Windows
HTML
 
Posts: 226 | Registered: June 08, 2003Report 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] Conditional BY fields in a report

Copyright © 1996-2020 Information Builders