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.
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 ( 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 :
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 :
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
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
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
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 :
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
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
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