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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
WebFOCUS and SQL
 Login/Join
 
Member
posted
Hi there,

Can somebody tell me how to blend SQL and WebFOCUS together? For example, if I want to have my joins in SQL and proceed with the result of the join with WebFOCUS. Any configuration needed or you can just embed SQL with WebFOCUS?

Any ideas will be greatly appreciated.
 
Posts: 6 | Registered: October 19, 2005Report This Post
Platinum Member
posted Hide Post
You need to have the SQL PASSTHRU set to ON in the environment. Here is an example.

SET SQLENGINE = SQLMSS
SQL
SELECT ctc.c_last_name, count(isl.id) as total
FROM AHD.ctct ctc,
AHD.issalg isl,
AHD.issue iss
WHERE ctc.id=isl.analyst
AND isl.issue_id =iss.persid
AND isl.type = 'INIT'
AND isl.time_stamp > '1128211200'
AND iss.close_date > '1128211200'
AND iss.requestor IN
(SELECT id FROM AHD.ctct ctc
WHERE ctc.c_ctp_id = '2305')
Group by ctc.c_last_name
Order by total desc
FOR FETCH ONLY WITH UR;
TABLEF FILE SQLOUT
PRINT *
ON TABLE HOLD AS RGSQLOUT FORMAT ALPHA
END
TABLE FILE RGSQLOUT
PRINT *
WHERE READLIMIT EQ 100
END
 
Posts: 176 | Location: Desplaines | Registered: August 05, 2004Report This Post
Platinum Member
posted Hide Post
You need to have the SQL PASSTHRU set to ON in the environment. Here is an example.

SET SQLENGINE = SQLMSS
SQL
SELECT ctc.c_last_name, count(isl.id) as total
FROM AHD.ctct ctc,
AHD.issalg isl,
AHD.issue iss
WHERE ctc.id=isl.analyst
AND isl.issue_id =iss.persid
AND isl.type = 'INIT'
AND isl.time_stamp > '1128211200'
AND iss.close_date > '1128211200'
AND iss.requestor IN
(SELECT id FROM AHD.ctct ctc
WHERE ctc.c_ctp_id = '2305')
Group by ctc.c_last_name
Order by total desc;
TABLEF FILE SQLOUT
PRINT *
ON TABLE HOLD AS RGSQLOUT FORMAT ALPHA
END
TABLE FILE RGSQLOUT
PRINT *
WHERE READLIMIT EQ 100
END
 
Posts: 176 | Location: Desplaines | Registered: August 05, 2004Report This Post
Member
posted Hide Post
I had already tried that from looking at the old posts but I still couldnt get it to work. For example I get this error:
"(FOC012) THE WORD 'FILE' OR THE FILENAME APPEARS TWICE BYPASSING TO END OF COMMAND"

How do you set SQL PASSTHRU to ON?
Is there any way of knowing if your configuration is set to be used for SQL and WebFOCUS code?

Thanks!
 
Posts: 6 | Registered: October 19, 2005Report This Post
Member
posted Hide Post
And if it helps, this is my simple code of what I am trying to do:

SET SQLENGINE=SQLMSS

SQL SELECT LAST_NM, FIRST_NM
FROM NAMES1_TABLE
UNION ALL
SELECT LAST_NM, FIRST_NM
FROM NAMES2_TABLE
;

TABLE FILE SQLOUT
PRINT *
END
 
Posts: 6 | Registered: October 19, 2005Report This Post
Member
posted Hide Post
You probably need a Data Connection to the database and/or an ENGINE SQLMSS statement.

ENGINE SQLMSS SET SERVER &DataConnection
SET SQLENGINE = SQLMSS
ENGINE SQLMSS
SELECT *
FROM tablename;
TABLE FILE SQLOUT
PRINT *
IF READLIMIT EQ 5
END
 
Posts: 22 | Location: Milano, Italy | Registered: September 16, 2005Report This Post
Gold member
posted Hide Post
You can actually do that in FOCUS without worrying about SQL. If you want just 2 columns, one with last name (from both tables and one with first from both tables,
TABLE FILE NAMES1_TABLE
 
Posts: 60 | Location: 2 penn | Registered: May 22, 2003Report This Post
Gold member
posted Hide Post
Sorry, I tried cut-and-paste and it sent the message before I was done.
TABLE FILE NAMES1_TABLE
PRINT LAST_NM FIRST_NM
MORE
FILE NAMES2_TABLE
END

This should give you what you want. If you want 4 columns, merged on a common key (such as SSN, then look at MATCH FILE
 
Posts: 60 | Location: 2 penn | Registered: May 22, 2003Report This Post
Member
posted Hide Post
Woddy,
what would Data Connection represent? server name? Is it the same as declaring connection attributes?

PS: Thanks Noreen for the suggestion but I am working with many and that was just an example.
 
Posts: 6 | Registered: October 19, 2005Report This Post
Member
posted Hide Post
A Data Connection is just what it indicates - a connection to the database. WebFocus doesn't know which database you wish to use unless you (or your WebFocus Administrator) creates a Data Connection. As a simple test - if you can query any table in a given database with WebFocus then you already have a connection. If you cannot access any tables via WebFocus then you probably need a Data Connection. Speak with your WebFocus Administrator.

The member "newtofocus" demonstrates the WebFocus SQL Passthru syntax more elaborately that my previous post. The query also demonstrates SQL Joins. What you may (and I emphasize the word "may") be missing is either a Data Connection or the ENGINE SQLMSS statement. (See my previous post.) The ENGINE SQLMSS statement isn't always needed, but I have found that it sometimes makes the difference.

Regarding Noreen's suggestion, both MORE and MATCH will combine several result sets together. MORE requires the each result set to have the same file structure whereas MATCH requires each result set to have the same BY field.

If these suggestions don't achieve the desired result, please elaborate on your requirement.
 
Posts: 22 | Location: Milano, Italy | Registered: September 16, 2005Report This Post
Member
posted Hide Post
Thank you much Woody, Noreen, and newtofocus!
It's working nowSmiler

PS:
I know how to use MORE and MATCH but with the code that I am working on, it is very inefficient using either of them.
 
Posts: 6 | Registered: October 19, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders