Pages

Monday, February 27, 2017

How to pull a value through relationship in result set portlet in start center?

For selecting columns to display in the result set portlet we'll get the list of persistent attributes for the object that the query is based on.
This attribute list will be present in RESULTSETCOLS table. We will not get the related attributes by default.



To add a related attribute we've to prepare and execute an insert statement in the database. (See example below)

Example:
You need to see buyer name in result set portlet configured with query based on Purchase Orders (PO) application.
Buyer name will be there in PERSON table, we need to create a relationship in PO object with PERSON as child object (say: BUYER) where clause for the relationship will be personid=:purchaseagent
To see BUYER.DISPLAYNAME in the result set columns execute the below query.


Oracle:
insert into resultsetcols (app, attribute, maintable, resultsetcolsid ,rowstamp)
values ('PO', 'BUYER.DISPLAYNAME', 'PO', resultsetcolsseq.nextval, maxseq.nextval);

DB2:
insert into resultsetcols (app, attribute, maintable, resultsetcolsid)
values ('PO', 'BUYER.DISPLAYNAME', 'WORKORDER', nextval for resultsetcolsseq);

update maxsequence
set maxreserved=(select max(resultsetcolsid) from resultsetcols)
where tbname='RESULTSETCOLS' and name='RESULTSETCOLSID';

SQS (Microsoft SQL Server):
insert into resultsetcols (app, attribute, maintable, resultsetcolsid)
values
('PO', 'BUYER.DISPLAYNAME', 'WORKORDER', resultsetcolsseq.nextval);

No comments:

Post a Comment