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.
Iam doing an Sql passthrough which goes something like this : select COUNT(*) from (select distinct y,z from table1 where x in (&var)and y is not null ); END
Later Iam tring to do this : TABLE FILE SQLOUT PRINT * ON TABLE SET ASNAMES ON ON TABLE SAVE AS s1 END -RUN -*-EXIT
Now Iam trying to read the count variable which is getting printed in the above table file request and I tried reading it using its Alias name(E01): but that doesnt seem to work...
-READ S1 &E01.D20.2. -TYPE &E01 -EXIT
Could anyone please let me know the column name which needs to be used in the read and in the type commands as I have already done a count(*) in Sql passthrough...
Thanks a lot in advance!This message has been edited. Last edited by: info4pal,
Hi, -READ doesn't have any knowledge about fields or aliases or field formats. -READ simply reads strings of text from a text file. It puts these into dialogue manager variables.
If you run your "SAVE" section with the -EXIT i.e.
TABLE FILE SQLOUT
PRINT *
ON TABLE SET ASNAMES ON
ON TABLE SAVE AS s1
END
-RUN
-EXIT
You should see the results of the SAVE e.g. number of records and lines, as well as what was written to the TEXT file that the SAVE format created. There you will see the sequence and the length of the data. You would use that to construct your -READ e.g. if it shows a single column with a length of 12 (NB: length, not format), then your -READ would be something like this:
-READ S1 &whatever.12.
See the "WebFOCUS Developing Reporting Applications Release 8.0" manual for more info about -READ. It also has info about -READFILE, which could be another option.
WebFOCUS 8.2.06 mostly Windows Server
Posts: 195 | Location: Johannesburg, South Africa | Registered: September 13, 2008
Have you tried breaking this down and testing it bit by bit?
i.e.
TABLE FILE SQLOUT
SUM
CNT.field1
CNT.field2
END
-* If that works then try
TABLE FILE SQLOUT
SUM
CNT.DST.field1
CNT.DST.field2
END
-* If that works then try your HOLD FORMAT ALPHA and do
TABLE FILE SAVE1
PRINT *
END
-* If that works then check the -READ ...
-READ SAVE1 &field1.I5 &field2.I5
-TYPE &field1 &field2
Actualy, now that I look at it: Is it correct to specify the data type in a -READ statement? You are saving in ALPHA and your read suggests that the values are integers. I don't have time right now to sus this out, so at least check on that. In the back of my head is a notion that you can only specify the length of your fields with -READ, not the type.This message has been edited. Last edited by: George Patton,
Here's an example of counting the number of countries and cars from the CAR file and using -READFILE to get the values into AMP variables.
Here's the FEX:
-TYPE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -TYPE +++ COUNT COUNTRIES AND CARS IN CAR FILE +++ -TYPE +++ HOLD FILE AS HLD_VARS +++ -TYPE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ TABLE FILE CAR SUM CNT.DST.COUNTRY AS 'CNT_CNTRY' CNT.DST.CAR AS 'CNT_CAR' ON TABLE SET HOLDLIST PRINTONLY ON TABLE SET ASNAMES ON ON TABLE HOLD AS HLD_VARS END -RUN -TYPE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -TYPE +++ DISPLAY LAYOUT OF HLD_VARS HOLD FILE +++ -TYPE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ? HOLD HLD_VARS -RUN -TYPE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -TYPE +++ SET AMP VARS BY USING -READFILE OF HLD_VARS +++ -TYPE +++ DISPLAY AMP VARS USING TYPE COMMANDS +++ -TYPE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -READFILE HLD_VARS -TYPE -------------------------------- -TYPE CNT_CNTRY ----- &CNT_CNTRY -TYPE CNT_CAR ------- &CNT_CAR -TYPE -------------------------------- -RUN
This is what I get when I run this:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++ COUNT COUNTRIES AND CARS IN CAR FILE +++ +++ HOLD FILE AS HLD_VARS +++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 0 NUMBER OF RECORDS IN TABLE= 10 LINES= 1 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++ DISPLAY LAYOUT OF HLD_VARS HOLD FILE +++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 0DEFINITION OF HOLD FILE: HLD_VARS 0FIELDNAME ALIAS FORMAT CNT_CNTRY E01 I5 CNT_CAR E02 I5 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++ SET AMP VARS BY USING -READFILE OF HLD_VARS +++ +++ DISPLAY AMP VARS USING TYPE COMMANDS +++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -------------------------------- CNT_CNTRY ----- 5 CNT_CAR ------- 10 --------------------------------
Maybe this will help.
~Jim
WebFocus 8.201M, Windows, App Studio
Posts: 227 | Location: Lincoln Nebraska | Registered: August 12, 2008