Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Justin James
MVP
405
Views
7
Comments
How to dynamically add items to a combo box's "special list"?
Question
Hello -
Interesting challenge... I have a combo box and I need to use the "special list", but the contents of the "special list" will change depending on runtime considerations (like the user's roles).
For a while, I have done one of two things:
1. Make a structure just for this combo box, and make the ID of the structure a text field that acts like the "special value", and build the record list of these structures from real data.
2. Have multiple combo boxes with my different special list values, using If widgets to hide the "wrong" ones, then have them each bound to a different ID variable, and then use logic to determine when ID variable to really use.
Both of these are pretty ugly approaches to what I would hope to be a simple issue. Is there a way to change the contents of the Special List programmatically?
Thanks!
J.Ja
João Fernandes
Hello Justin,
Have you tried not using the "special list" at all? For example in your preparation you could:
Do the query to fetch the data to show in the combo box
Create a local variable
Assign to the local variable
ListApeend the variable intro the query result
Probably you have though about it, but I think that this could be a better approach than using lots of UI IFs and combos.
Justin James
MVP
Joao -
That's choice #1 above. The trick here, is that I use the "special value" to not be an actual ID, but an action name. For example, a list like this:
1. Add a new item
2. Item #1
3. Item #2
...
And if the user selects option 1 (Add a new item), a new screen is popped up to allow them to create the new item. So what I do is I have a "value" of "add" or something like that, and I check the value. That's why, if I am going to manipulate the bound list, I need to make a structure to represent the list.
J.Ja
João Fernandes
I don't think there are other "cleaner" options, but perhaps:
Create a static entity that contains the possible actions
Create a entity Action_User that has all the actions a user (or role) can execute
Do a query to fetch from Action_User filtered by user/role
Populate the combo box with the result of the query
Justin James
MVP
Joao -
Yes, I could see that being a good approach if there are more than one or two things to put into the special list. For me, I usually only 2 values at most, so it's more effort than I need. Thanks for the suggestion though!
J.Ja
Chandrasekar Radhakrishnan
Hi,
How to add subsections inside a combo box.For eg if i have the Electronix as my
first list then under Electroninx i need to add subsections like Laptop,Tv,Refrigreator.How can i do this.Is there any way of doing .
Regards,
ChandrasekarRadhakrishnan
Justin James
MVP
You can use ListAppend and ListInsert to add custom items to the "SourceRecordList" that the Combo Box pulls options from.
J.Ja
Chandrasekar Radhakrishnan
Hi,
For this i need to create a structure or just i have to create one action .You have any sample oml file for this.
Regards,
CR
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...