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.
New TIBCO Community Coming Soon
In early summer, TIBCO plans to launch a new community—with a new user experience, enhanced search, and expanded capabilities for member engagement with answers and discussions! In advance of that, the current myibi community will be retired on April 30. We will continue to provide updates here on both the retirement of myibi and the new community launch.
What You Need to Know about Our New Community
We value the wealth of knowledge and engagement shared by community members and hope the new community will continue cultivating networking, knowledge sharing, and discussion.
During the transition period, from April 20th until the new community is launched this summer, myibi users should access the TIBCO WebFOCUS page to engage.
Is it possible to include a holdfile in a sql statement. (see example)
- first select values from CAR - Print them to a holdfile - use second select and use holdfile by including it (I now it has to be a fex) - finally print result
Simple example :
-* First selection SQL SELECT DISTINCT COUNTRY FROM ( SELECT * FROM CAR WHERE COUNTRY IN ('ENGLAND', 'JAPAN', 'ITALY' ) ) ; TABLE ON TABLE HOLD AS H001 END
-* Make a holdfile with the IN values TABLE FILE H001 PRINT COUNTRY AS '' COMPUTE COMMA/A1 = IF COUNTRY EQ 'JAPAN' THEN '' ELSE ','; ON TABLE SET PAGE-NUM NOLEAD ON TABLE SET ASNAMES ON ON TABLE HOLD AS INVALUES ON TABLE NOTOTAL END
-* New selection based on holdfile SQL SELECT COUNTRY, CAR FROM ( SELECT * FROM CAR WHERE COUNTRY IN ( -INCLUDE INVALUES -*holdfile ) ) ; TABLE ON TABLE HOLD AS H002 END
TABLE FILE H002 PRINT * ENDThis message has been edited. Last edited by: <Kathryn Henning>,
Yes you can. However, in your example you have 2 problems: 1. Your HOLD file should be in FORMAT ALPHA and should have the .fex extension. 2. You have to ensure that JAPAN is in fact the last value encountered
SQL
SELECT DISTINCT COUNTRY
FROM
( SELECT *
FROM CAR
WHERE COUNTRY IN ('ENGLAND', 'JAPAN', 'ITALY' )
)
;
TABLE ON TABLE HOLD AS H001
END
-* Make a holdfile with the IN values
FILEDEF INVALUES DISK INVALUES.FEX
TABLE FILE H001
PRINT
COMPUTE COMMA/A1 = IF COUNTRY EQ 'JAPAN' THEN '' ELSE ',';
BY COUNTRY
ON TABLE SAVE AS INVALUES
END
-* New selection based on holdfile
SQL
SELECT COUNTRY, CAR
FROM
( SELECT *
FROM CAR
WHERE COUNTRY IN (
-INCLUDE INVALUES
)
)
;
TABLE ON TABLE HOLD AS H002
END
TABLE FILE H002
PRINT *
END
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006
Unfortunately, there is an error in your code Danny and without quotes embracing the alpha values in a IN clause I don't know how it can work.
It may not be as elegant as it should, but it works:
SQL
SELECT DISTINCT COUNTRY
FROM
( SELECT *
FROM CAR
WHERE COUNTRY IN ('ENGLAND', 'JAPAN', 'ITALY')
)
;
TABLE ON TABLE HOLD AS H001
END
-TYPE &LINES
-SET &INVALUES = '';
-SET &I = 0;
-REPEAT GENLST &LINES TIMES
-SET &I = &I + 1;
-READ H001 &VAL.&I.A10.
-TYPE &VAL.&I
-SET &INVALUES = &INVALUES || '''' || &VAL.&I || '''';
-SET &INVALUES = IF &I LT &LINES THEN &INVALUES || ',' ELSE &INVALUES;
-GENLST
-TYPE &INVALUES
SQL
SELECT COUNTRY, CAR
FROM
( SELECT *
FROM CAR
WHERE COUNTRY IN (
&INVALUES
)
)
;
TABLE ON TABLE HOLD AS H002
END
TABLE FILE H002
PRINT *
END
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
Posts: 2410 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013
FILEDEF INVALUES DISK INVALUES.FEX
TABLE FILE H001
PRINT
COMPUTE COMMA/A1 = IF COUNTRY EQ 'JAPAN' THEN '' ELSE ',';
BY COUNTRY
ON TABLE SAVE AS INVALUES
END
To this:
FILEDEF INVALUES DISK INVALUES.FEX
TABLE FILE H001
PRINT
COMPUTE QCOUNTRY/A12='''' || COUNTRY || '''';
COMPUTE COMMA/A1 = IF COUNTRY EQ 'JAPAN' THEN '' ELSE ',';
BY COUNTRY NOPRINT
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SAVE AS INVALUES
END
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006