cancel
Showing results for 
Search instead for 
Did you mean: 

How can i obtain the field values of the selected record in a Result Set Component.

Former Member
0 Kudos

Hi, hope you guys can help,

I have three component usages which are:

Search

Result Set

Item Details

They are all linked to the same repository bean. When the user clicks on a record in the result set, I would like to get the string values of certain fields in that record. Any ideas?

Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor
0 Kudos

did you put the itemdetail in the screen?

if yes, you can get the itemdetail interface,and then call getFieldValue via the interface

amolgupta
Active Contributor
0 Kudos

Hi Yassir,

One way of doing it is through Portal Eventing.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c2fad86f-0401-0010-91ac-bdb38595a...

More details in the link provided. Both Views should be in the same Portal Page.

I hope this solves your problem.

Regards,

-Amol Gupta

junwu
Active Contributor
0 Kudos

this is not related.

amolgupta
Active Contributor
0 Kudos

Hi Yassir,

If you have 1). one view for Search, 2). one view for Result Set in a Table and 3). one view for Item Details which will show the Details. You can/will put all your views on the same page.

On click of a row (lead selection) in a table in 2). you raise a Portal event, passing the unique id of the row. Portal Event Handling in 3). will catch that event with the item unique id and process that Item Detail in the view, fetch the record independently from the data repository/backend based on the unique id thus obtained.

The same concept is clearly depicted in the Screenshot above and link mentioned.

If you implement the same, your Item Details view will immediately show the respective Item Details on lead selection of respective table row in the Result Set view.

Now all this discussion is built on the prerequisite that you can make the 3 views as 1).2).3). mentioned here and that you want to show the details of a record selected in view 2) in view 3).

Pls correct me if my understanding is incorrect.

Regards,

-Amol Gupta

junwu
Active Contributor
0 Kudos

it is mdm wd. it is not appropriate to use your solution.

amolgupta
Active Contributor
0 Kudos

Hi Yassir,

You may like to go through the following document by Chris Whealy-

Componentization Exercise in Web Dynpro Java

http://scn.sap.com/docs/DOC-2586

This will give you an understanding of how to divide your solution into components and how to use/reuse features/functionalities embedded inside a component.

As shown in screen shot below, visual entitities are exposed through interface view and programmatic entities are exposed through Interface controller.

Regards,

-Amol Gupta

Former Member
0 Kudos

Hi guys,

Thank you for the help so far, however I will rephrase my original question to make it more clear.

I have the 3 components (search, result, item details) on a single view. They are all connected to a single repository bean so when the user clicks on a certain record, the item details component updates as required.

So for example, I have a Person table in MDM and these three components are used to search, display and show all field attributes for any Person that is selected from the result set. A Person has attributes such as Name, Age and Favourite sport. So, when a Person record is clicked in the result set, not only do I wish for the item details to be updated with Person details (this works fine), I also want to do a search in the Sports table and display information about the 'favourite sport' of the Person from the Sports table such as Country of Origin, Contact Sport, # of Players etc.

So I think I will need to retrieve the Person selected in the result set, obtain his attribute called 'Favourite Sport' and then get the corresponding record from the Sports table and display details of the sport.

I can use a recordSelectionEvent Event Handler and this executes when a record is selected from the result set component however, at this time the Item Details component has not been updated yet with 'clicked Records' details. So how can I obtain the 'Favourite Sport' field value when a record is clicked from the result set.

Is there a better way to do this?

Hope the question is more clear.

Thanks

junwu
Active Contributor
0 Kudos

there is another event in the itemdetail you can listen to

recordloaded event.

in that event handler you can get the value you want.

Former Member
0 Kudos

That seems to be what im looking for Thanks.

However, calling ItemDetails.getFieldValue returns me a value like 'R1', not the actual display value 'Football'. Any ideas

Thanks

Former Member
0 Kudos

Okay I think I've got it by casting to StringValue

junwu
Active Contributor
0 Kudos

you can use <itemdetailInterface>.getRecord().getLookupDisplayValue("")

Former Member
0 Kudos

Hi Jun,

The method getLookupDisplayValue requires a FieldID. At first I thought this is the same as MDM code for the field but if I specify this code, it does not give me the fields value.

I have tried this:

 

FieldId fid =

new FieldId("SPORT");

wdComponentAPI.getMessageManager().reportSuccess(wdThis.wdGetItemDetailsCompInterface().getRecord().getLookupDisplayValue(fid));

However, this gives me IllegalArgumentException.

If it helps, in MDM the only field set as a display field is 'Name'.

junwu
Active Contributor
0 Kudos

<mdmrecord>.getMetadata().getFieldId( "code")

Former Member
0 Kudos

Hi Jun,

You have help me so much Thank you!

One last question. Now that I have obtained the value in the field 'Favourite Sport', e.g. Football as String, what is the best way to obtain the Item Details of the record with attribute 'Name' with value Football, from table Sports?

Thanks

junwu
Active Contributor
0 Kudos

cannot follow you......what you are talking?

Former Member
0 Kudos

I have a Result Set which shows 5 records. I wish for my Item Details component to show the record which has the value 'Football' in the 'Name' Field.

I can do <ItemDetailsInterface>.setRecordId() but how do i get the recordId of the record with "Football" in 'Name' field from Result Set.

Thanks

Former Member
0 Kudos

Is there anyway I can interate through a Result Set component, and get each record then check for each record

if 'Name' field = 'Football'

     RecordId rid = getRecordId;

<ItemDetailsInterface>.setRecordId(rid);

This will then show my required record but how do I obtain all records in Result Set in a loop.

Thanks

Answers (0)