How to dynamically add items to a combo box's "special list"?

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?


Hello Justin,

Have you tried not using the "special list" at all? For example in your preparation you could:
  1. Do the query to fetch the data to show in the combo box
  2. Create a local variable
  3. Assign to the local variable
  4. 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.
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.

I don't think there are other "cleaner" options, but perhaps:
  1. Create a static entity that contains the possible actions
  2. Create a entity Action_User that has all the actions a user (or role) can execute
  3. Do a query to fetch from Action_User filtered by user/role
  4. Populate the combo box with the result of the query
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!

 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 .

You can use ListAppend and ListInsert to add custom items to the "SourceRecordList" that the Combo Box pulls options from.

For this i need to create a structure or just i have to create one action .You have any sample oml file for this.