85
Views
2
Comments
Solved
How to get both Id and label from Dropdown
Question
Application Type
Reactive

Hi Community,

I have this question, which i thought it should be simple, but i had spent way too much time on this. So I am reaching out to you guys,

1. In my attached OML, screen name 'DropdownLabelandIDs' - i have an aggregate 'DropdownStatuses', which is used to populate the dropdown in the screen

2. As the dropdown requires a variable, i have a local variable 'EmployeeOnboardingStatusId' for it

3. However, i have in my Widget Tree, some containers to display, depending on which status is selected. I had only do it for New and Submitted Status. Cause i think you will get the point.

4. Cause i need to pass in the Label value, so that i can display in the container, and user knows which Label they had selected.

So my question is, is calling or fetching another aggregate the only way to handle this?

Thanks!

DropDown.oml
2019-01-07 16-04-16
Siya
 
MVP
Solution

Issue is DropdownStatuses.List.Current.EmployeeOnboardingStatus.Label and is always returns the first item ( 'New')  irrespective whichever value selected in the dropdown. Hence you resorted to create a new  aggregate to get the Label of the selected item. 

You can use Listfilter on the aggregate and get the Label of the selected item without having to execute another aggregate. I have updated your solution by adding a new screen which demonstrate this. Hope this helps.

DropDownSearchDemo.oml
2023-12-14 09-56-57
Yogesh Javir

Hello @Jun Mun Chan
1.Create calculated attribute in your DropdownStatus aggregate as shown below
2.Use this calculated value as optionvalue

3.Change data tyoe if EmployeeOnboardingStatusId variable to text and use substr(EmployeeOnboardingStatusId,"-",0) to compare value of lable.

Hope this will help.

Thanks

2019-01-07 16-04-16
Siya
 
MVP
Solution

Issue is DropdownStatuses.List.Current.EmployeeOnboardingStatus.Label and is always returns the first item ( 'New')  irrespective whichever value selected in the dropdown. Hence you resorted to create a new  aggregate to get the Label of the selected item. 

You can use Listfilter on the aggregate and get the Label of the selected item without having to execute another aggregate. I have updated your solution by adding a new screen which demonstrate this. Hope this helps.

DropDownSearchDemo.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.