Focal Point
[SOLVED] How to convert SQL query into WebFocus query

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4361042081

August 14, 2006, 08:29 AM
Animesh Verma
[SOLVED] How to convert SQL query into WebFocus query
Hi,
I am working with WebFocus for the first time and i dont know how to write the following sql query in Webfocus.I know we can write sql query in WebFocus but i want to know how to write in Webfocus syntax.Here is the query

select * from people_dim where MGR_CORP_ID in

(select MGR_CORP_ID from people_dim where CORP_ID='&corp_id' and end_dt is null )


If anyone can please help me out with this fast. Idea

This message has been edited. Last edited by: Kerry,
August 14, 2006, 08:43 AM
Pete
Hi,

Should be something like this :

TABLE FILE PEOPLE_DIM
PRINT *
WHERE (CORP_ID EQ '&corp_id' AND END_DT IS MISSING)
END

Make sure that the master and access-file for this table exist

P.


D: WF 7.6.2 P. : WF 7.6.2 on W2003
------------------------------------------------------------------
I see myself as an intelligent, sensitive human, with the soul of a clown which forces me to blow it at the most important moments.

-Jim Morrison-

August 14, 2006, 09:35 AM
Tony A
.... or using SQL PASSTHRU -

 ENGINE SQLMSS SET SERVER [connector name]
-* Where [connector name] is a valid connector in your configuration
-* Check WebFOCUS manuals or consult with your WF administrator
-*
-* Set the engine to the SQL datasource you are going to use
 SET SQLENGINE = SQLMSS
-* Turn varchar recognition off - comment out if not required
 SQL SQLMSS SET VARCHAR OFF
-RUN

SQL
  SELECT *
    FROM people_dim
   WHERE MGR_CORP_ID in (SELECT MGR_CORP_ID
                           FROM people_dim
                          WHERE CORP_ID='&corp_id' AND end_dt is null)
;
TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD AS anyname
END
-RUN

TABLE FILE anyname
PRINT field ........
WHERE field EQ somevalue
END


I tend to use upper case for SQL syntax but you can use mixed case if you want. The column names MUST be as the datasource column name (as per SQL!).

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
August 14, 2006, 09:41 AM
Pete
Yup T.,

But would this pass-thru suffice?

  
SQL
  SELECT *
    FROM people_dim
   WHERE CORP_ID='&corp_id' AND end_dt is null
;
TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD AS anyname
END




D: WF 7.6.2 P. : WF 7.6.2 on W2003
------------------------------------------------------------------
I see myself as an intelligent, sensitive human, with the soul of a clown which forces me to blow it at the most important moments.

-Jim Morrison-

August 14, 2006, 09:56 AM
Tony A
Just repeating the SQL provided Pete, not intending to teach SQL on this forum Wink Music

lol

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
August 14, 2006, 10:19 AM
Pete
*smirk*


D: WF 7.6.2 P. : WF 7.6.2 on W2003
------------------------------------------------------------------
I see myself as an intelligent, sensitive human, with the soul of a clown which forces me to blow it at the most important moments.

-Jim Morrison-

August 23, 2006, 10:00 AM
Kerry
Hi all,

FYI, the issue has been resolved as Animesh tried the suggestions on this topic. Many thanks for everyone's input. Good One

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
August 24, 2006, 01:50 AM
Animesh Verma
Hi,
I am really sorry for the late response.I would like to thanx everyone for their valuable inputs & their precoius time. Good One
March 07, 2012, 08:24 AM
csmathan
quote:
Originally posted by Animesh Verma:
Hi,
I am working with WebFocus for the first time and i dont know how to write the following sql query in Webfocus.I know we can write sql query in WebFocus but i want to know how to write in Webfocus syntax.Here is the query

select * from people_dim where MGR_CORP_ID in

(select MGR_CORP_ID from people_dim where CORP_ID='&corp_id' and end_dt is null )


If anyone can please help me out with this fast. Idea


Hi, i think this will help u..

TABLE FILE PEOPLE_DIM
PRINT *
WHERE (CORP_ID EQ '&corp_id' AND END_DT EQ '')
END


regards,
mathan Sathianathan


WebFOCUS 7.x
Windows, All Outputs
March 07, 2012, 12:32 PM
njsden
Hey Mathan,

Para-phrasing Tom Flynn when I did something similar a while ago, I'm sure Animesh already found a solution to this more than 5 years ago Big Grin

It's easy to get caught in the loop whenever one is looking for "stuff" here in the forum and ends up giving thought to really old posts which may not be relevant to author anymore ... been there, done that myself Roll Eyes

By the way, welcome to the forum! Smiler



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.