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     Adding a single column after all across columns

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Adding a single column after all across columns
 Login/Join
 
Virtuoso
posted
Is it possible to put a single column at the right-most end of the output of a series of ACROSS columns?

I'm generating a number of WHERE clauses from a data-file and OR-ing them together using ACROSS and COMPUTE, but I'm kind of stuck getting a semi-colon (Wink at the end of each line...

My code is similar to:
DEFINE FILE CAR
 SELITEM/A8 = DECODE COUNTRY('FRANCE' 'MODEL' 'ITALY' 'SEATS' ELSE '');
 SELVALS/A15 = DECODE COUNTRY('FRANCE' 'EQ ''504 4 DOOR''' 'ITALY' 'EQ 4' ELSE '');
 WHERELINE/A26 = IF SELITEM EQ '' OR SELVALS EQ '' THEN '' ELSE '('|SELITEM||' '|SELVALS||')';
END
TABLE FILE CAR
 SUM
    COMPUTE  CONDITION/A32 = IF WHERELINE EQ '' THEN ''
                  ELSE IF (LAST COUNTRY EQ COUNTRY)
                  THEN '   OR ' | TRIM('T', WHERELINE, 26, ' ', 1, 'A26')
                  ELSE 'WHERE ' | TRIM('T', WHERELINE, 26, ' ', 1, 'A26'); AS ''

 BY COUNTRY NOPRINT
 ACROSS CAR NOPRINT
WHERE COUNTRY EQ 'FRANCE' OR 'ITALY' OR 'SPAIN';
END


The result of this query, saved as FORMAT ALPHA, is to be -INCLUDE'd as the WHERE clause in another TABLE FILE query.
For that purpose, obviously, each line should end with a ';'. How do I do that?


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
<FreSte>
posted
Wep,

You can add a COMPUTE'd field at the end like:

...
  BY COUNTRY NOPRINT
  ACROSS CAR NOPRINT
  COMPUTE SC/A1 = ';';
WHERE COUNTRY EQ 'FRANCE' OR 'ITALY' OR 'SPAIN';
END


-Fred
 
Report This Post
Virtuoso
posted Hide Post
That field will repeat for each ACROSS value though. Without a way to detect that I'm at the last ACROSS value, that won't help.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Virtuoso
posted Hide Post
Hmmm, as far as I know any COMPUTE field you add *after* the ACROSS clause will be appended at the end of the report right after the last ACROSS which seems to be what you wanted. Did you actually try FreSte's suggestion and it didn't work? If that's the case I'll have to revise my old assumptions Roll Eyes



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Virtuoso
posted Hide Post
I don't think you need the across to do what you want. Try:
  DEFINE FILE CAR
 SELITEM/A8 = DECODE COUNTRY('FRANCE' 'MODEL' 'ITALY' 'SEATS' ELSE '');
 SELVALS/A15 = DECODE COUNTRY('FRANCE' 'EQ ''504 4 DOOR''' 'ITALY' 'EQ 4' ELSE '');
 WHERELINE/A26 = IF SELITEM EQ '' OR SELVALS EQ '' THEN '' ELSE '('|SELITEM||' '|SELVALS||')';
END
TABLE FILE CAR
 SUM 
   COMPUTE C_COUNTRY_CTR/I1 = CNT.CAR; NOPRINT
  BY COUNTRY NOPRINT
 SUM
   COMPUTE C_CAR_CTR/I5 = IF COUNTRY EQ LAST COUNTRY THEN LAST C_CAR_CTR + 1  ELSE 1; NOPRINT
    COMPUTE  CONDITION/A32 = IF WHERELINE EQ '' THEN ''
                  ELSE IF (LAST COUNTRY EQ COUNTRY)
                  THEN '   OR ' | TRIM('T', WHERELINE, 26, ' ', 1, 'A26')
                  ELSE 'WHERE ' | TRIM('T', WHERELINE, 26, ' ', 1, 'A26'); AS ''
   COMPUTE COMMA/A1 = IF C_CAR_CTR EQ C_COUNTRY_CTR THEN ';' ELSE ' '; AS ''
 BY COUNTRY NOPRINT
 BY CAR NOPRINT
WHERE COUNTRY EQ 'FRANCE' OR 'ITALY' OR 'SPAIN';
END



Output:
 
WHERE (MODEL EQ '504 4 DOOR') ; 
WHERE (SEATS EQ 4) 
OR (SEATS EQ 4) ; 


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Virtuoso
posted Hide Post
quote:
Originally posted by njsden:
Hmmm, as far as I know any COMPUTE field you add *after* the ACROSS clause will be appended at the end of the report right after the last ACROSS which seems to be what you wanted. Did you actually try FreSte's suggestion and it didn't work? If that's the case I'll have to revise my old assumptions Roll Eyes


Doh! I hadn't noticed that the COMPUTE was after the ACROSS and didn't know it would behave differently at that spot.

Thanks for pointing that out.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Platinum Member
posted Hide Post
Does it work for you?

DEFINE FILE CAR
SELITEM/A8 = DECODE COUNTRY('FRANCE' 'MODEL' 'ITALY' 'SEATS' ELSE '');
SELVALS/A15 = DECODE COUNTRY('FRANCE' 'EQ ''504 4 DOOR''' 'ITALY' 'EQ 4' ELSE '');
WHERELINE/A26 = IF SELITEM EQ '' OR SELVALS EQ '' THEN '' ELSE '('|SELITEM||' '|SELVALS||')';
SEMI_COLON/A1 = ';';
END
TABLE FILE CAR
SUM
COMPUTE CONDITION/A32 = IF WHERELINE EQ '' THEN ''
ELSE IF (LAST COUNTRY EQ COUNTRY)
THEN ' OR ' | TRIM('T', WHERELINE, 26, ' ', 1, 'A26')
ELSE 'WHERE ' | TRIM('T', WHERELINE, 26, ' ', 1, 'A26'); AS ''

BY COUNTRY NOPRINT
BY SEMI_COLON AS ''
ACROSS CAR NOPRINT
WHERE COUNTRY EQ 'FRANCE' OR 'ITALY' OR 'SPAIN';
ON TABLE SET NODATA ' '
ON TABLE SET STYLE *
TYPE=REPORT, COLUMN=SEMI_COLON, SEQUENCE=90,$
ENDSTYLE
END


WF 7.7.02 on Windows 7
Teradata
HTML,PDF,EXCEL,AHTML
 
Posts: 165 | Registered: September 29, 2008Report This Post
Expert
posted Hide Post
As atturhari shows, you can use the SEQUENCE attribute in the style sheet to change the position of a column in a report.


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
<FreSte>
posted
This SEQUENCE attribute is OK for HTML-output, but for writing to HOLD-files, it doesn't work.
Wep needs these HOLD-files with WHERE-statements for including in other fexes.
I also use this kind of dynamice WHERE-statements; very powerfull
 
Report This Post
Platinum Member
posted Hide Post
Its actually very easy. It depends on where you put the Compute. In this case put it after the ACROSS. The syntax is..
TABLE FILE CAR
SUM RETAIL_COST
BY COUNTRY
ACROSS BODYTYPE AND COMPUTE NEW= C1 + C3 ;
END

Note that the columns can be identified as C1,C2, etc


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     Adding a single column after all across columns

Copyright © 1996-2020 Information Builders