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 just need to display a % symbol for one particular row value while generating the tabular report
I need generate the report like below.
CAR ENGLAND RUSSIA JAPAN USA
BMW 10 20 30 50
BMW1 10 20 30 50
BMW2 10% 20% 30% 50%
BMW3 10 20 30 50
If you see in the about report, I put CAR in the BY field and COUNTRY as across field.
My requirement is for BMW2 I need to show the '%' symbol only for this row specifically and other rows should come as it is with out percentage symbol...
How can we generate the percentage symbol for one particular row.
DEFINE FILE CAR
PER2/D9 = SALES/RETAIL_COST;
PER3/A13=FTOA(PER2, '(D9)',PER3);
PER4/A15=IF CAR EQ 'BMW' THEN (PER3 || '%') ELSE PER3;
END
TABLE FILE CAR
SUM PER4
BY CAR
ACROSS COUNTRY
END
In Focus since 1993. WebFOCUS 7.7.03 Win 2003
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005
The functionality you are looking for is called dynamic reformatting.
DEFINE FILE CAR
CFORMAT/A8=DECODE COUNTRY('ENGLAND' 'D10%' 'JAPAN' 'D10' ELSE 'D10.2');
END
TABLE FILE CAR
SUM SALES/CFORMAT DEALER_COST/CFORMAT
BY COUNTRY
END
Thanks! for the technique given, for the ACROSS columns based on the BY fields using the technique DECODE I could able to change the format dynamically but how can we achieve the same for the computed or calcuated columns. For instance
DEFINE FILE CAR
CFORMAT/A8=DECODE COUNTRY('ENGLAND' 'D10%' 'JAPAN' 'D10' ELSE 'D10.2');
CFORMATB/A8=DECODE COUNTRY('ITALY' 'D10.2' 'JAPAN' 'D10%' ELSE 'D10.2%');
END
TABLE FILE CAR
SUM SALES/CFORMAT DEALER_COST/CFORMAT
COMPUTE BLAH/D20.2 = SALES/DEALER_COST; NOPRINT
BLAH/CFORMATB
BY COUNTRY
END
(What is "becz"?)
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
The functionality you are looking for is called dynamic reformatting.
Very nice, N Selph. I learned a lot here. This dynamic reformatting only works with the appearance of the report, not the internal storage. COMPUTE won't work, hold them to temp file won't work.
DEFINE FILE CAR
CFORMAT/A8=DECODE COUNTRY('ENGLAND' 'D10%' 'JAPAN' 'D10' ELSE 'D10.2');
CFORMAT1/A8=DECODE COUNTRY('ITALY' 'D10%' 'W GERMANY' 'D10' ELSE 'D10.2B');
CFORMAT2/A8=DECODE COUNTRY('FRANCE' 'D10B' 'JAPAN' 'D10%' ELSE 'D10.2-');
NET1/D12.2 = SALES - DCOST;
NET2/D12.2 = SALES - DCOST;
END
TABLE FILE CAR
SUM SALES/CFORMAT DEALER_COST/CFORMAT
NET1/CFORMAT1 NET2/CFORMAT2
BY COUNTRY
-*ON TABLE HOLD AS H1 FORMAT FOCUS
END
-*TABLE FILE H1
-*PRINT *
-*END
Thanks.
Hua
Developer Studio 7.6.11 AS400 - V5R4 HTML,PDF,XLS
Posts: 305 | Location: Winnipeg,MB | Registered: May 12, 2008
I really understand the logic but I'm using BY and ACROSS and creating the computed or calculated values. Here is what I modified the code a little to show my requirement and this is throwing error
DEFINE FILE CAR
CFORMAT/A8=DECODE COUNTRY('ENGLAND' 'D10%' 'JAPAN' 'D10' ELSE 'D10.2');
CFORMATB/A8=DECODE COUNTRY('ITALY' 'D10.2' 'JAPAN' 'D10%' ELSE 'D10.2%');
END
TABLE FILE CAR
SUM SALES/CFORMAT DEALER_COST/CFORMAT
BY COUNTRY
ACROSS CAR
COMPUTE BLAH/D20.2 = SALES/DEALER_COST; NOPRINT
BLAH/CFORMATB
END
How can we change the computed column values formats dynamically at run time when we call the computed columns after ACROSS (reason I'm creating the computed columns after ACROSS stmts is I need to generate columns at the end of the report) ?
-* Douglas Lee: File ID: BY_ACROSS_Format.fex
-* http://forums.informationbuild...71057331/m/569109545
DEFINE FILE CAR
CFORMAT/A8=DECODE COUNTRY('ENGLAND' 'D10%' 'JAPAN' 'D10' ELSE 'D10.2');
CFORMATB/A8=DECODE COUNTRY('ITALY' 'D10.2' 'JAPAN' 'D10%' ELSE 'D10.2%');
END
TABLE FILE CAR
SUM
SALES/CFORMAT
DEALER_COST/CFORMAT AS 'DCOST'
BY COUNTRY
ACROSS CAR
-*COMPUTE BLAH/D20.2 = SALES/DEALER_COST; NOPRINT
-*BLAH/CFORMATB
-IF COUNTRY EQ 'JAPAN' THEN GOTO D10PCT ELSE GOTO D102 ;
-D102
COMPUTE BLAH/D20.2 = SALES/DEALER_COST;
-GOTO FORMATDONE
COMPUTE BLAH/D20% = SALES/DEALER_COST;
-FORMATDONE
WHERE COUNTRY IN ('ENGLAND' 'JAPAN')
END
In FOCUS Since 1983 ~ from FOCUS to WebFOCUS. Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005
I don't think the solution that you gave will satisfy my requirement. I can't show the formated values(%,D12.2 something like for each row) for different country, car combination differently.
The issue is for Computed columns dynamic formating. Any new solution?
I'm posting the same message again... ----------------------
Hi Francis,
I really understand the logic but I'm using BY and ACROSS and creating the computed or calculated values. Here is what I modified the code a little to show my requirement and this is throwing error
DEFINE FILE CAR CFORMAT/A8=DECODE COUNTRY('ENGLAND' 'D10%' 'JAPAN' 'D10' ELSE 'D10.2'); CFORMATB/A8=DECODE COUNTRY('ITALY' 'D10.2' 'JAPAN' 'D10%' ELSE 'D10.2%'); END
TABLE FILE CAR SUM SALES/CFORMAT DEALER_COST/CFORMAT BY COUNTRY ACROSS CAR
COMPUTE BLAH/D20.2 = SALES/DEALER_COST; NOPRINT BLAH/CFORMATB END
How can we change the computed column values formats dynamically at run time when we call the computed columns after ACROSS (reason I'm creating the computed columns after ACROSS stmts is I need to generate columns at the end of the report) ?
This correction makes the program run without error, check the results and let us know if it solves your format problem:
-* File subbu1.fex
DEFINE FILE CAR
CFORMAT/A8=DECODE COUNTRY('ENGLAND' 'D10%' 'JAPAN' 'D10' ELSE 'D10.2');
CFORMATB/A8=DECODE COUNTRY('ITALY' 'D10.2' 'JAPAN' 'D10%' ELSE 'D10.2%');
END
TABLE FILE CAR
SUM SALES/CFORMAT DEALER_COST/CFORMAT
BY COUNTRY
ACROSS CAR
PRINT
COMPUTE BLAH/D20.2 = SALES/DEALER_COST; NOPRINT
BLAH/CFORMATB
END
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
It might be easiest to calculate your computes as a separate query and combine the output with your initial results before producing the final output. Here's an example using the EMPDATA file:
SET ASNAMES = ON
SET HOLDLIST = PRINTONLY
APP FILEDEF EMPHOLD DISK EMPHOLD.FTM (APPEND
DEFINE FILE EMPDATA
AREAX/A15 = AREA ;
LAST_AREA/A15 = 'ZZZZZ';
END
TABLE FILE EMPDATA
SUM SALARY
COMPUTE AREA_TEXT/A15 = AREA ;
BY AREAX
BY JOBCLASS
ON TABLE HOLD AS EMPHOLD
END
TABLE FILE EMPDATA
SUM SALARY
COMPUTE AREA_TEXT/A15 = 'TOTALS';
BY LAST_AREA
BY JOBCLASS
ON TABLE SAVB AS EMPHOLD
END
DEFINE FILE EMPHOLD
SFORMAT/A8 = IF (JOBCLASS CONTAINS 'S') THEN 'D10.1%' ELSE 'D12.2M';
END
TABLE FILE EMPHOLD
SUM SALARY/SFORMAT AS 'Salary'
BY JOBCLASS
ACROSS AREAX NOPRINT
ACROSS AREA_TEXT AS ''
ON TABLE SET PAGE NOPAGE
ON TABLE PCHOLD FORMAT HTML
END
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
I think I need to bring my code what I did for better understanding...
DEFINE FILE SUMDATA
RFMTS/A30=DECODE METRIC('CLAIM' 'D10' 'UNIQUE_GUEST_COUNT' 'D10' 'NEWNT' 'D10' 'PMU' 'D12.2%' 'BRD' 'D12.2%' 'GEN' 'D12.2%' ELSE 'D10.2');
END
TABLE FILE SUMDATA
SUM
TOTVALUES NOPRINT
VALUES/RFMTS AS ''
BY STORE
BY ORD NOPRINT
BY MNAME AS 'METRIC'
BY METRIC NOPRINT
ACROSS FN AS '' NOPRINT
ACROSS FDESC AS ''
ACROSS WEEK_END AS ''
-SET &K = 1;
-REPEAT ENDREPEAT3 FOR &I FROM 1 TO 3
-IF &XREGION.&I EQ 'PRECMM' THEN AVGPRE1 ELSE ALL1;
-AVGPRE1
COMPUTE PCINC&I/D12.2% = IF (METRIC EQ 'CLAIM' OR 'UNIQUE_GUEST_COUNT' OR 'NEW_GUEST_COUNT') THEN &MSTR
ELSE IF METRIC EQ 'SALES_PER_CLAIM' THEN &SLSTOT/&CLMT
ELSE IF METRIC EQ 'PROFIT_PER_CLAIM' THEN &PRFTOT/&CLMT
ELSE 999
-ENDREPEAT3
END
in the above code, I have called the RFMTS field to apply dynamic formating and what happens is for the computed columns the d12.2% format is not applying instead it is taking d12.2 as a new format even though I have called d12.2% the % is disappearing. Another problem is I have applied the style for the computed column by using the column notation and it is not properly applying when dynamic formating is applied for the called columns
The question is when we do dynamic formating on the pring fields can the computed field creates something new columns with different formats (like here d12.2 as default ) instead of the defined format D12.2% ?
second one is you can see the loop I have created after the across how can we called the defined column RFMTS for the computed columns. LIKE BELOW. Any thoughts ?
DEFINE FILE SUMDATA
RFMTS/A30=DECODE METRIC('CLAIM' 'D10' 'UNIQUE_GUEST_COUNT' 'D10' 'NEWNT' 'D10' 'PMU' 'D12.2%' 'BRD' 'D12.2%' 'GEN' 'D12.2%' ELSE 'D10.2');
END
TABLE FILE SUMDATA
SUM
TOTVALUES NOPRINT
VALUES/RFMTS AS ''
BY STORE
BY ORD NOPRINT
BY MNAME AS 'METRIC'
BY METRIC NOPRINT
ACROSS FN AS '' NOPRINT
ACROSS FDESC AS ''
ACROSS WEEK_END AS ''
-SET &K = 1;
-REPEAT ENDREPEAT3 FOR &I FROM 1 TO 3
-IF &XREGION.&I EQ 'PRECMM' THEN AVGPRE1 ELSE ALL1;
-AVGPRE1
COMPUTE PCINC&I/RFMTS = IF (METRIC EQ 'CLAIM' OR 'UNIQUE_GUEST_COUNT' OR 'NEW_GUEST_COUNT') THEN &MSTR
ELSE IF METRIC EQ 'SALES_PER_CLAIM' THEN &SLSTOT/&CLMT
ELSE IF METRIC EQ 'PROFIT_PER_CLAIM' THEN &PRFTOT/&CLMT
ELSE 999
-ENDREPEAT3
END
You cannot have COMPUTE statements after the verbs ACROSS or BY
Yes, you can. But, this compute will not take the dynamic format from the field, its format is fixed. Consider this example:
DEFINE FILE CAR
RFMTS/A8 = DECODE COUNTRY('ENGLAND' 'D10.1' 'JAPAN' 'D10.2' 'ITALY' 'D10M' 'FRANCE' 'D12.2%' ELSE 'D10.2');
END
TABLE FILE CAR
SUM DCOST NOPRINT
RCOST NOPRINT
BY COUNTRY
SUM DCOST/RFMTS AS ''
RCOST/RFMTS AS ''
BY COUNTRY
ACROSS SEATS AS ''
-REPEAT ENDREPEAT3 FOR &I FROM 1 TO 3
COMPUTE PCINC&I/D12.2% = (C2 - C1) / &I;
-ENDREPEAT3
END
It will give you the dynamic formats for the separate rows, it shows the compute after the across, but when you change the format for the computes to RFMTS, then it will throw an error message.
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007
DEFINE FILE CAR
RFMTS/A8 = DECODE COUNTRY('ENGLAND' 'D10.1' 'JAPAN' 'D10.2' 'ITALY' 'D10M' 'FRANCE' 'D12.2%' ELSE 'D10.2');
END
TABLE FILE CAR
SUM DCOST NOPRINT
RCOST NOPRINT
BY COUNTRY
SUM DCOST/RFMTS AS ''
RCOST/RFMTS AS ''
BY COUNTRY
ACROSS SEATS AS ''
PRINT
-REPEAT ENDREPEAT3 FOR &I FROM 1 TO 3
COMPUTE PCINC&I/D12.2% = (C2 - C1) / &I; NOPRINT
PCINC&I/RFMTS
-ENDREPEAT3
END
It appears you cannot use dynamic formatting in a COMPUTE, but you can use it in a subsequent reference to the newly computed field.
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