Sunteți pe pagina 1din 3

HOWTO Select Distinct values with EAI Siebel Adapter in Siebel 7.

8 and higher
==============================================================================
Issue a "SELECT DISTINCT" SQL statement from EAI Siebel Adapter in Siebel 7.8 an
d higher
Solution
Business components in Siebel 7.8 and higher have a property "Distinct"that when
set to true cause the business component to retrieve only distinct records.
It is explained in bookshelf :
Siebel Object Types Reference > Siebel Object Types > Business Component
A TRUE or FALSE value. Setting this property to TRUE allows the equivalent of a s
elect distinct query because it suppresses system fields (such as Created, Updat
ed, Id, and so).
You may want to clone this business component if you plan to use it in other are
as within the application.

1.Sample usage scenario #1: Query distinct parent records (Action business compo
nent).

?In the user interface (UI) create two activities with "Description" = abc.
?In Siebel Tools, create an "Action_Distinct" business component(BC) with only o
ne field: Description.
?Set the Distinct propety to TRUE.
?Create a Business Object(BO) "Action_Distinct" and set the BC "Action Distinct"
as the primary BC.
?Create an Integration Object (IO) "Action_Distinct" using the Siebel Tools wiza
rd (File->New Object->EAI -> Integration Object).
This IO will be based on "Action_Distinct" BO and have only the "Action_Distinc
t" (BC).
?Inactivate all IC fields except for "Description". IC Field "Description" shoul
d be the only one active.
?Compile the SRF.
?In site map -> Administration - Business Service -> Simulator run EAI Siebel Ad
apter, method Query with inputs :
OutputIntObjectName = Action_Distinct
SearchSpec = [Action_Distinct.Description]='abc'
?This will return only one record !
?The log file contains a SQL similar to this :
ObjMgrSqlLog Detail 4 000000024a4e0e00:0 2009-07-03 17:21:52 SELECT statement wi
th ID: B71B050
SELECT /*+ ALL_ROWS */ DISTINCT
T1.NAME
FROM
SIA80.S_EVT_ACT T1
WHERE
(T1.NAME = :1)
ObjMgrSqlLog Detail 4 000000024a4e0e00:0 2009-07-03 17:21:52 Bind variable 1: ab
c

2.Sample usage scenario #2: Query distinct child records with a searchspec at th
e parent record. (Query an account by Row_Id and bring all distinct child activ
ities).
?In the UI create account "MyTestAccnt", drill down it and create 3 activities a
s child of account :
2 Activities with Description=abc
1 Activity with Description=def
?In Tools:
Update BC: Action_Distinct and add field "Account Id" (created in previous scena
rio).
Create a new link : Account/Action_Distinct
Edit BO: Account and add Action_Distinct as a child through link Account/Action_
Distinct
Create a new IO: Account_Action_Distinct
Compile the SRF.
?In BS Simulator, run EAI Siebel Adapter, Method Query with :
OutputIntObjectName = Account_Action_Distinct
PrimaryRowId=6SIA-554W5 (put the row id for the account from your own system her
e)
It returns the Parent Account data and only 2 activities :
one activity abc (there were 2 so distinct works)
one activity def (there was really only one).
In the log the following SQL statement is seen:
SELECT /*+ ALL_ROWS */ DISTINCT
T1.NAME
FROM
SIA80.S_EVT_ACT T1
WHERE
(T1.TARGET_OU_ID = :1)

3.Sample usage scenario #3: Query distinct child records with a searchspec at th
e parent record and at the child record.(Query an account by name plus disctinct
activities with description abc).

? With the same objects from scenario #2 go to BS Simulator and run EAI Siebel
Adapter, Method Query with :
OutputIntObjectName = Account_Action_Distinct
SearchSpec=[Account.Name]='123' and [Action_Distinct.Description]='abc'
?The result is the parent account plus only one record with abc (there were 2 "a
bc" + one record with "def")
?The SQL statement in the log is :
SELECT /*+ ALL_ROWS */ DISTINCT
T1.NAME
FROM
SIA80.S_EVT_ACT T1
WHERE
(T1.NAME = :1) AND
(T1.TARGET_OU_ID = :2)
ObjMgrSqlLog Detail 4 000000024a4e0c24:0 2009-07-03 18:05:58 Bind variable 1: ab
c
ObjMgrSqlLog Detail 4 000000024a4e0c24:0 2009-07-03 18:05:58 Bind variable 2: 6S
IA-554W5
Conclusion:
The conclusion is the BC must have the distinct property set to True and can ha
ve as many fields as needed but the IO must have only the fields to be included
in the "select distinct" part of the SQL.
e.g: In scenarios 2 and 3 above the IO always had "Description" as the only acti
ve field even though the BC had "Description" and "Account Id".
The reason is all fields in the IO will be automatically activated. If you add n
on distinct fields, they will be added to the query and therefore result in more
records.
In summary, in these 3 test scenarios it is feasible to obtain a distinct value
from EAI Siebel Adapter:
a) Single BC with "Distinct" property. IO with this single BC. IO with only "dis
tinct fields".
b) Parent-Child structure: The child must be a BC with "Distinct" property set t
o True. Searchspec only on parent by RowId brings distinct children.
c) Parent-Child structure: The child must be a BC with "Distinct" property set t
o True. Searchspec on parent by any field on the parent PLUS a searchspec on chi
ld. will bring only one, distinct child .

S-ar putea să vă placă și