cancel
Showing results for 
Search instead for 
Did you mean: 

Resolving a 1:n Association to a single row

VinitaSinha
Advisor
Advisor
0 Kudos

Hi,

I have a requirement wherein there are 2 BOs, and the first BO has a 1:n association to the other BO. On the UI, I want to show fields from both the BOs in ONE row, but after resolving 1 particular instance.

For eg: If the 2nd BO has 3 records, and only one of them is valid for the period I login, I should pick up only that record and show its fields along with other fields of the first BO.

BO1                                               BO2

ID, Desc, Type                              ID, BO1 ID, Current valid Indicator    Amount

01     Test1   A                               1,    01,           True,                                   1000

                                                       2,   01,           False,                                  2000

                                                       3,   01,           False,                                  3000

UI:

ID    Desc    Type     ID   Amount
01    Test1    A          1    1000

Although there are 3 records for the ID 01 of the BO1 via association to BO2, I should pick up only the first record to show on the UI. How should one resolve a 1:n association in UI designer ?

Kind Regards

Vinita

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Vinita,

The way I would do this, is:

in the UI-Designer

1. create a sub-list in the data model to model the 1:n cardinality

2. Bind it to the BO that has n instances

3. use an event handler and ruby script to set the lead selection to the correct record

e.g.


lead = 2

$data.MainList.SubList.SetLeadSelectedIndex(lead)

4. bind the data fields of the sub-list to the respective UI elements in the List pane of the main list

=> the entries from the lead selection of the sub list will be shown in the main list.

Best regards,

Ludger

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Vinita,

If you can determine the validity in a field inside the BO you can define an association with the "valuation" keyword like

association ValidAssoc [0,1] to SubNode valuation (Period == ValidPeriod);

Then you take this association inside the UI Designer.

HTH,

    Horst

Former Member
0 Kudos

Actually, Horsts approach is the better one.

However it is restriced to associations within the same BO (to subnodes of the BO is fine).

According to your description, the second BO is a different BO, so valuation associations might not be usable.

If your "other BO" are actually subnodes (or you can move them inside the parent BO), use valuations.

Since you already have a "valid indicator" in the item in question in the BO, you probably do not need aditional logic inside the BO.

Best regards,

Ludger

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello,

Yes, that's right: The valuaton association must point to a node inside the BO itself.

So, if your second BO (the target) can determine the valid period it works.

Bye,

    Horst