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 there a way to do use FOCUS code instead of SQL to convert columns to rows, as in this SQL example:
SQL
SELECT 'DEALER_COST' AS COLNAME, DEALER_COST AS COLVALUE FROM CAR
WHERE COUNTRY = 'ENGLAND'
UNION
SELECT 'RETAIL_COST' AS COLNAME, RETAIL_COST AS COLVALUE FROM CAR
WHERE COUNTRY = 'ENGLAND'
UNION
SELECT 'SEATS' AS COLNAME, SEATS AS COLVALUE FROM CAR
WHERE COUNTRY = 'ENGLAND'
UNION
SELECT 'SALES' AS COLNAME, SALES AS COLVALUE FROM CAR
WHERE COUNTRY = 'ENGLAND';
TABLE ON TABLE HOLD AS H001 FORMAT ALPHA
END
Thanks,
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
De gustibus ... this looks no more complicated to me:
DEFINE FILE CAR
NAME1/A12 ='DEALER_COST '; VALUE1/D8.1= DEALER_COST ;
NAME2/A12 ='RETAIL_COST '; VALUE2/D8.1= RETAIL_COST ;
NAME3/A12 ='SALES '; VALUE3/D8.1= SALES ;
NAME4/A12 ='LENGTH '; VALUE4/D8.1= LENGTH ;
NAME5/A12 ='WIDTH '; VALUE5/D8.1= WIDTH ;
NAME6/A12 ='HEIGHT '; VALUE6/D8.1= HEIGHT ;
NAME7/A12 ='WEIGHT '; VALUE7/D8.1= WEIGHT ;
NAME8/A12 ='WHEELBASE '; VALUE8/D8.1= WHEELBASE ;
END
MATCH FILE CAR
BY COUNTRY BY CAR BY MODEL BY NAME1 AS COLNAME BY VALUE1 AS COLVALUE
RUN
FILE CAR
BY COUNTRY BY CAR BY MODEL BY NAME2 AS COLNAME BY VALUE2 AS COLVALUE
AFTER MATCH HOLD OLD-OR-NEW
RUN
FILE CAR
BY COUNTRY BY CAR BY MODEL BY NAME3 AS COLNAME BY VALUE3 AS COLVALUE
AFTER MATCH HOLD OLD-OR-NEW
RUN
FILE CAR
BY COUNTRY BY CAR BY MODEL BY NAME4 AS COLNAME BY VALUE4 AS COLVALUE
AFTER MATCH HOLD OLD-OR-NEW
RUN
FILE CAR
BY COUNTRY BY CAR BY MODEL BY NAME5 AS COLNAME BY VALUE5 AS COLVALUE
AFTER MATCH HOLD OLD-OR-NEW
RUN
FILE CAR
BY COUNTRY BY CAR BY MODEL BY NAME6 AS COLNAME BY VALUE6 AS COLVALUE
AFTER MATCH HOLD OLD-OR-NEW
RUN
FILE CAR
BY COUNTRY BY CAR BY MODEL BY NAME7 AS COLNAME BY VALUE7 AS COLVALUE
AFTER MATCH HOLD OLD-OR-NEW
RUN
FILE CAR
BY COUNTRY BY CAR BY MODEL BY NAME8 AS COLNAME BY VALUE8 AS COLVALUE
AFTER MATCH HOLD OLD-OR-NEW
END
TABLE FILE HOLD PRINT COLVALUE
BY COUNTRY BY CAR BY MODEL BY COLNAME
END
- Jack Gross WF through 8.1.05
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
How are you going to use the HOLD file? I am assuming that since you are putting the column titles in the rows you don't need a master file. My rows don't come out in the same order as yours but that should be fixable.
I used the following code:
TABLE FILE CAR
PRINT DEALER_COST
OVER RETAIL_COST
OVER SEATS
OVER SALES
WHERE COUNTRY EQ 'ENGLAND'
ON TABLE HOLD AS H001 FORMAT LOTUS
-*ON TABLE HOLD AS H001 FORMAT WP
ON TABLE SET PAGE NOLEAD
END
...and... if you want to use constants instead of the field names you could DEFINE or COMPUTE those values and use AS '' for all the fields.This message has been edited. Last edited by: Piipster,
ttfn, kp
Access to most releases from R52x, on multiple platforms.
Posts: 346 | Location: Melbourne Australia | Registered: April 15, 2003
JG - nice technique for using MATCH to UNION rather than JOIN - I'm sure that I will find a use.
You could go the McGuiver route
JOIN ONE WITH LENGTH IN CAR TO ALL ONE IN MCGUYVER AS J1
DEFINE FILE CAR NAME/A12 = IF MCVAL EQ 1 THEN 'DEALER_COST ' ELSE IF MCVAL EQ 2 THEN 'RETAIL_COST ' ... VALUE/D8.1= IF MCVAL EQ 1 THEN DEALER_COST ELSE IF MCVAL EQ 2 THEN RETAIL_COST ... END TABLE FILE CAR PRINT NAME VALUE BY COUNTRY BY CAR BY MODEL BY MCVAL NOPRINT END
Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2 Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
Posts: 888 | Location: Airstrip One | Registered: October 06, 2006