103
Views
7
Comments
Solved
Linked Combo Boxes
Question

Hello,

I would like to link two Combo Boxes and achieve the following:

1.  If I select an item in Combo Box A, it will filter the related items in Combo Box B.  Entity A is the parent of Entity B in the data model.

2.  If I select an item in Combo Box B, it will automatically select the parent item in Combo Box A.

How do I do this ?

Cheers, Richard.

Rank: #872
Solution

Hello Richard, 

I think that this video is perfect for you to understand how to start this.

https://www.youtube.com/watch?v=r8-4qdEbSng

Good work!

Camila

Rank: #95

Hey Richard,

Create 2 variables (1 for each dropdown, with the correct type).
Create 2 on change actions (1 for each dropdown).
In your preparation query the selection of A and B and use these in your combo boxes.
In the aggregate for B, use the following filter: VariableForA = NullIdentifier() OR B.ParentId = VariableForA

Now for the on change action on B, if the variable for A is empty, set the variable you for A to the value of the parent. Then use an Ajax Refresh on combo box A.

For the on change action on A, use a data refresh on the aggregate for B (in your preparation), you might want to set the variable for B to NullIdentifier() aswell, then refresh the combo box for B.

This shouldn't be too difficult to implement, but let me know if you have any problems still.

Rank: #347

Hi Richard,

Here is a basic example. I attached an OML file.
Hope it helps.


With best regards,
F.Karatay

Example.oml

Rank: #947

Here is my solution to this (I can't share the OML because my Personal environment is down for maintenance)

The second aggregate has a filter by the parent Id. Each Combobox is bound to the corresponding Entity variable.

The on change is bound to the Entity A combobox then refreshes the GetEntityBSByEntityAId and an Ajax Refresh to the Combo Box that holds Entity Bs value

You really should look to what Camila Teixeira linked. i watched it and It is exacty what you need.


BR

you need to do something like this:
 https://www.outsystems.com/forums/discussion/46674/read-widgets-during-extended-properties-onchange/
But in the on change action of the 1st dropdown, you need to drag a refresh data widget (to update your 2nd dropdown) with filters to make what you want and then an ajax refresh to update the 2nd dropdown.
I hope it will helps you.
Thanks and Best Regards,
Nuno Pereira