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.
I'm including some simple TABLE FILE queries that do not have an output format specified yet. Is there some way to specify that using a setting instead of using ON TABLE PCHOLD?
The reason for this is that I want to keep those table file definitions as generic as possible; I don't want to include the output format in them, but instead want to control that from outside the TABLE FILE definition. Can that be done? And if so, how?
I'm effectively trying to accomplish something similar to what /ibi_apps/RemoteValues does (see also the discussion on "Wanting to beat HTML Composer into submission!"), but done properly.
What I'm looking for would look like the following:
<script type="text/javascript">
var tableFile = $("#query").text();
var data = "SET HOLD = PCHOLD\r\nSET FORMAT = XML\r\n" + tableFile;
</script>
<div id="query" style="display:none;">
TABLE FILE CAR
SUM FST.CAR
BY CAR
BY MODEL
WHERE COUNTRY = &country;
END
</div>
P.S. A JSON output format would even be better, but that doesn't appear to be supported (in our version).This message has been edited. Last edited by: Kerry,
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 :
Regarding your comment about wanting JSON. Here is sample of something similar to what was used on a project of mine.
SET MESSAGE = OFF
SET HOLDLIST = PRINTONLY
-* FILEDEF to store the text file
FILEDEF H2 DISK h2.txt (APPEND
-RUN
TABLE FILE CAR
SUM
COMPUTE CNT/I11 = CNT + 1;
COMPUTE OPTION/A65 = '{"carText":"' || CAR || '", "carValue":"' || CAR || '"}';
BY CAR NOPRINT
ON TABLE HOLD AS H1
END
-RUN
-SET &LAST_RECORD = &RECORDS;
-* Write Opening Bracket
-WRITE H2 [
-* Write JSON items
TABLE FILE H1
PRINT
COMPUTE OPTION/A70 = IF CNT EQ &LAST_RECORD THEN OPTION ELSE OPTION || ',';
ON TABLE HOLD AS H2 FORMAT ALPHA
END
-RUN
-* Write Closing Bracket
-WRITE H2 ]
-* Output the text file using EDAGET
EX EDAGET TXT,h2.txt,T
Originally posted by Mighty Max: How about SET ONLINE-FMT? It's in the help file but it does not specify XML.
Ah, brilliant, that works! Silly documentation...
Regarding the JSON format; I can't readily hard-code all that stuff as I don't know what the query will be like before-hand. It just gets sent verbatim to the reporting server, which is also why I can't use ON TABLE PCHOLD.
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 :
If I execute this code in the command console (I call the adhocfex in my code):
SET ONLINE-FMT=XML
-SET &ECHO = ALL;
SET ASNAMES=ON
SET HOLDLIST=PRINTONLY
TABLE FILE CAR
SUM COMPUTE CS/A43 = CAR | ' ('|| MODEL || ')';
BY COUNTRY
BY CAR
BY MODEL
END
The result is:
0 ERROR AT OR NEAR LINE 11 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC034) THE PRINT LINE EXCEEDS THE MAXIMUM LINE WIDTH. WIDTH IS: 98
If I use ON TABLE PCHOLD FORMAT XML instead of SET OUTPUT-FMT=XML the code works, but I can't do that in my application...
Is there a way around this issue?
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 :
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 :