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     ACROSS, BY value format

Read-Only Read-Only Topic
Go
Search
Notify
Tools
ACROSS, BY value format
 Login/Join
 
Gold member
posted
Hi,

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.

Thanks!
 
Posts: 78 | Registered: January 07, 2008Report This Post
Virtuoso
posted Hide Post
Maybe something like this?

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, 2005Report This Post
Guru
posted Hide Post
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


(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
 
Posts: 391 | Location: California | Registered: April 14, 2003Report This Post
Virtuoso
posted Hide Post
I forgot about that...
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Gold member
posted Hide Post
Hi Selph,

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

  

TYPE   COL1   COL2  COL3  COMCOL1 COMCOL2

ABC     10    20     30    20.00   20%
DEF     10    20     30    22.00   10.00 
GHI     10%   20%    30%   10 %    30.00
IJK     10    20     30    10      40.00



The row "ABC" and its computed columns COMCOL1 COMCOL2 has the format "D12.2" and "D12%"

How can we achieve this specfically for computed values.

My code looks like below

  

TABLE FILE FILENAME

SUM VALUE
  BY TYPE  
  ACROSS COLUMNS
  COMPUTE COMCOL1/? = SOME CALUCALATION
  COMPUTE COMCOL2/? =  SOME CALUCALATION

END


The computed columns COMCOL1,COMCOL2 values format should come dynamically as per the mockup given above.

I have added "?" for the format becz the format should come dynamically based on the by TYPE Column.


WebFOCUS 7.6.10
Windows
Output: Excel,PDF
 
Posts: 78 | Registered: January 07, 2008Report This Post
Expert
posted Hide Post
Try this:

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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
See if this works:

Insert a COMPUTE (with NOPRINT) for the desired output format first, and reference it as the format of the displayed COMPUTE column.


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Guru
posted Hide Post
quote:
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, 2008Report This Post
Master
posted Hide Post
Keep in mind that the FORMAT field MUST have a format of A8. If you define as A5 (for example to hold 'D10.2') it will not work.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report This Post
Gold member
posted Hide Post
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) ?

Error Message : BLAH Field/word not recognized.

Thanks!


WebFOCUS 7.6.10
Windows
Output: Excel,PDF
 
Posts: 78 | Registered: January 07, 2008Report This Post
Expert
posted Hide Post
Consider this:
-* 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, 2005Report This Post
Gold member
posted Hide Post
Hi Doug,

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) ?

Error Message : BLAH Field/word not recognized.
 
Posts: 78 | Registered: January 07, 2008Report This Post
Expert
posted Hide Post
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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
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, 2007Report This Post
Gold member
posted Hide Post
Hi Francis,

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



WebFOCUS 7.6.10
Windows
Output: Excel,PDF
 
Posts: 78 | Registered: January 07, 2008Report This Post
Expert
posted Hide Post
You cannot have COMPUTE statements after the verbs ACROSS or BY. Adding the PRINT seemed to make it work.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
quote:
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, 2007Report This Post
Expert
posted Hide Post
Thanks for the correction - I've not had the need for COMPUTES after a verb, I thought it wouldn't work.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Does this help?

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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
You can achieve what you need by using FML.

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, 2004Report This Post
Silver Member
posted Hide Post
Subbu,

Have you tried Formatting data based on row numbers?


WebFOCUS 8103 Appstudio, Dev Studio MRE
Client Windows 7, Serveron Unix.
Excel, PDF, HTML,AHTML
 
Posts: 38 | Registered: January 24, 2008Report 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     ACROSS, BY value format

Copyright © 1996-2020 Information Builders