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 have this sample SQL code. I am not sure how to use this variable in WebFOCUS code. Can someone let me know how to use it?
SELECT count(*) INTO :count1
FROM sales
WHERE sale_id = 1;
'received_count1'
SELECT count(*) INTO :count2
FROM sales
WHERE sale_id = 2;
'received_count2'
I have multiple queries like this. If its a group of fields, I use SQLOUT to push them into hold file. But how do I use a value coming out of these queries? I am not sure if value is stored in COUNT1 or RECEIVED_COUNT1
Thank youThis message has been edited. Last edited by: Enigma006,
I think it's not quite possible to do this in one go within webfocus. Alternative would be to get the individual counts, store them in holds and -READ the holds into the corresponding &vars.
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007
If all of your counts come from the very same table, you could:
SQL [your_engine]
SELECT count(case when sale_id = 1 then 1 else null end) as RECEIVED_COUNT1,
count(case when sale_id = 2 then 1 else null end) as RECEIVED_COUNT2,
count(case when sale_id = 3 then 1 else null end) as RECEIVED_COUNT3
FROM sales
WHERE sale_id IN (1,2,3)
;
TABLE ON TABLE HOLD AS HCOUNTS
END
-RUN
-READFILE HCOUNTS
-TYPE &RECEIVED_COUNT1
-TYPE &RECEIVED_COUNT2
-TYPE &RECEIVED_COUNT3
Though it is not exactly an answer to your original question, it is a bit more efficient way to get many of the results you need with a single pass over your SALES table and one single data fetch from the database.
The INTO keyword typically means it's loading a table on the RDBMS. I'm guessing that :tablename is some dialect of this (SQL Server is #tablename). Maybe DB2?
Temp tables and global temp tables are the RDBMS conceptual answer to hold files.
Hi ABT, his original SQL is not loading data into a table. It is actually reading a single value (one row, one field) from it and placing the result in a client "variable" (in this case, :var looks like the syntax used by Oracle to refer to bind variables).
So, to achieve a similar functionality in WebFOCUS, that is, placing the results of single-row/field query in a Dialogue Manager variable one has to HOLD the results of the query and -READ from them as GamP had already suggested.
What I was trying to illustrate was how to get those many values in a single round-trip to the database as opposed to getting many individual ones with tiny HOLD files here and there.
Originally posted by njsden: Hi ABT, his original SQL is not loading data into a table. It is actually reading a single value (one row, one field) from it and placing the result in a client "variable" (in this case, :var looks like the syntax used by Oracle to refer to bind variables).
I don't usually appreciate people correcting me over nits and nats, but in this case I was way off. Thanks for setting the record straight.