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
select distinct
 Login/Join
 
Member
posted
Can anyone suggest how to write code in webfocus for select distinct query like this

select distinct
super.SUPVR_COST_ID,
RTRIM(SUPVR_LNAME) CONCAT ', ' CONCAT RTRIM(SUPVR_FNAME) CONCAT ' ' CONCAT RTRIM(SUPVR_MNAME) as FULL_NAME,
super.SUPVR_CODE,
vg2.LINE_SEG_NBR,
vg2.TRACK_SDTK_NBR,
integer(vg2.MILE_POST_BEG)/1000 + (vg2.MILE_POST_BEG - integer(vg2.MILE_POST_BEG)) as BEGMP,
integer(vg2.MILE_POST_END)/1000 + (vg2.MILE_POST_END - integer(vg2.MILE_POST_END)) as ENDMP,
vg2.SRVY_STN_LEN,
vg2.ELEV_BEG,
vg2.ELEV_END,
vg2.GRADE_PERCENT
from
RIS.TRPT_SUPERVISOR super,
RIS.VGRADE2 vg2
where
super.LINE_SEG_NBR = vg2.LINE_SEG_NBR
and super.SUPVR_COST_ID = ':5'
and super.SUPVR_COST_ID = ':6'
and abs(vG2.GRADE_PERCENT) >= :7
and 1=1
order by LINE_SEG_NBR, BEGMP, TRACK_SDTK_NBR
 
Posts: 14 | Registered: January 11, 2006Report This Post
Expert
posted Hide Post
Yes,

Retain your power within the SQL and pull a recordset using it -

ENGINE SQLORA SET SERVER adaptername
SET SQLENGINE = SQLORA
SQL
select distinct 
super.SUPVR_COST_ID, 
RTRIM(SUPVR_LNAME) CONCAT ', ' CONCAT RTRIM(SUPVR_FNAME) CONCAT ' ' CONCAT RTRIM(SUPVR_MNAME) as FULL_NAME, 
super.SUPVR_CODE, 
vg2.LINE_SEG_NBR, 
vg2.TRACK_SDTK_NBR, 
integer(vg2.MILE_POST_BEG)/1000 + (vg2.MILE_POST_BEG - integer(vg2.MILE_POST_BEG)) as BEGMP, 
integer(vg2.MILE_POST_END)/1000 + (vg2.MILE_POST_END - integer(vg2.MILE_POST_END)) as ENDMP, 
vg2.SRVY_STN_LEN, 
vg2.ELEV_BEG, 
vg2.ELEV_END, 
vg2.GRADE_PERCENT 
from 
RIS.TRPT_SUPERVISOR super, 
RIS.VGRADE2 vg2 
where 
super.LINE_SEG_NBR = vg2.LINE_SEG_NBR 
and super.SUPVR_COST_ID = ':5' 
and super.SUPVR_COST_ID = ':6' 
and abs(vG2.GRADE_PERCENT) >= :7 
and 1=1 
order by LINE_SEG_NBR, BEGMP, TRACK_SDTK_NBR;
TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD AS MYHOLD
END
-RUN


Now report from the HOLD file named MYHOLD -

TABLE FILE MYHOLD
.......

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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
<BillBrockington>
posted
You must add the prefix operator DST. before each field in the PRINT statement. This will cause the SQL code to say select distinct.

TABLE FILE TABLENAME
PRINT
DST.FIELD1
DST.FIELD2
DST.FIELD3
DST.FIELD4
DST.CMPL_NM
WHERE STATEMENTS
END
 
Report This Post
Platinum Member
posted Hide Post
Anubha :
Like Tony says, whenever possible, I would recommend that you use the SQL passthru technique to pull your data and then use the power of focus to massage/format/present data as a report.

This way you are working to the strengths of both - SQL (data extraction) and FOCUS(data manipulation). You would get to thoroughly test/tune your SQL first (EXPLAINs, Build indexes, etc) and then let FOCUS do what it does best.
Here is how it could look like -

SQL DB2 (or whatever engine you got)
SELECT
F1
, F2
, SUM(F3)
FROM HLQ.TBLNAME A
WHERE F99 = 'XX'
GROUP BY F1, F2
;
TABLE
ON TABLE HOLD AS H0001
END
-RUN
-*
TABLE FILE H0001
~~~~~~~ (you know the drill) ~~~~~~~
END

Good luck.
Sandeep M.


-------------------------------------------------------------------------------------------------
Blue Cross & Blue Shield of MS
WF.76-10 on (WS2003 + WebSphere) / EDA on z/OS + DB2 + MS-SQL
MRE, BID, Dev. Studio, Self-Service apps & a dash of fun !! Music
 
Posts: 218 | Location: Jackson, MS | Registered: October 31, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders