Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] converting select subquery in webfocus

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] converting select subquery in webfocus
 Login/Join
 
Member
posted
Hi,
I have a sql query that looks like this,
select a1.f1, a1.f2, a1.f3,
(select count(*) from a2 where a2.f1 = a1.f1 and a2.f2 = 'something') as "employee have no of a2 stuff"
from a1;
Any idea? why something is so easy in pl/sql but so complex in webfocus? How to use nested subquery in codition clause of main query in webfocus?
thanks
AK

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 14 | Registered: October 27, 2011Report This Post
Gold member
posted Hide Post
Hey Abu,
I believe you'll need to create a hold file to hold the results of your subquery on a2. Then join that hold file to a1.


Kevin Patterson
Appalachian State University
WebFOCUS 7.7.03
Windows, All Outputs
 
Posts: 57 | Registered: February 29, 2012Report This Post
Platinum Member
posted Hide Post
Hi

With WebFOCUS 77 You have the option to add a subquery on the master file level.
You can add a "virtual" field which will retrieve a single record from the sql sub-query,
then you can add a WHERE statement on this field which will be transalated to sql subquery request performed in the database.
You can download a presentation explaining how to use it given in Summit 2011:
metadata enhancements

Yours

Eran


Yours,
Eran
SRL Products

http://www.srl.co.il

 
Posts: 97 | Location: Tel Aviv, Israel | Registered: November 20, 2005Report This Post
Virtuoso
posted Hide Post
Maybe something like this:

SET ALL = PASS
-*
JOIN f1 IN a1 TO ALL f1 in a2 as J1
-*
TABLE FILE a1
 SUM
  FST.a1.f2
  FST.a1.f3
  CNT.a2.f1 AS 'employee have no of a2 stuff'
 BY a1.f1
 WHERE (a2.f2 EQ 'something');
END


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Gold member
posted Hide Post
You can also use the SQL Report Wizard. It allows you to insert sql directly into a Webfocus report. When you create a new procedure, in the window that pops up, change the "create with:" field to SQL Report Wizard.


Kevin Patterson
Appalachian State University
WebFOCUS 7.7.03
Windows, All Outputs
 
Posts: 57 | Registered: February 29, 2012Report This Post
Virtuoso
posted Hide Post
@Dan -

Maybe not. We are not told whether (f1, f2, f3) covers the primary key of a1, so the answer set may well contain duplicate rows.

A PRINT verb and a "conditional" left outer join would be needed to cover that possibility; or a carefully crafted MATCH FILE.


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Member
posted Hide Post
Thanks everyone for sharing your knowledge. Actually, the task for me was to determine if an employee is an alumni or not in our university. I had to count no of degrees awarded by our university for an employee and if someone has 1 or more degrees then he/she is an alumni. It was very simple in Oracle, i.e pl/sql.
However, for webfocus, I had to select all records from degree table and save it in a hold file (a very tiny fraction from university degree table are also an employee in our university). Then I joined this degree table with the original report containing all the current university employees. Then count degrees for all employees and if the count is > 0 then he/she is an alumni else not an anlumni. The report is working fine. However, I don't like the idea of selecting all records from the degree table and save it in a hold file. In pl/sql it could have been just a single subquery selecting from the degree table using emplyee ID. Because the degree table is huge it contains all the degrees awarded by the university from its inception but our university has only couple of thousand employees. Anyway, the report is working, thats the bottomline.
Thanks
Abu


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 14 | Registered: October 27, 2011Report This Post
Guru
posted Hide Post
Could you not join the Employee table to the Degree table and then count the number of times an employee is on the degree table ?


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] converting select subquery in webfocus

Copyright © 1996-2020 Information Builders