Multiple combo boxes how to recall previously checked values

Hello guys,
i am using Multi Combo Box component in my app it is really useful for me. However, I have a small problem that I can’t solve:

on page 1 I have a Multi Combo Box with a list of selectable values that I recover from my db. The user selects the values they want along with other information on the page and then stores everything. Works great!

On page 2, however, I have to update all the information previously entered on page 1, including that in the Multi Combo Box
So I have to show the Multi Combo Box with the same list of elements of page 1 (taken from the db) but this time populated with the data that the user had previously entered (these also taken from the db). How can I do?

I hope I have explained
Thank you all.

Can anyone help me? thanks

I managed to create something similar to a for loop but using some if … else, but I need to be able to add or remove CHECK from individual items in the list via code. Is there any way to do this? Thank you

I’m looking inside the Multi Combo Box component. It would be great to be able to pass him for example a parameter with the name of the value in the list and at that point he turns it on \ check (item.selected) … but how do I do it ??

I have created a property for the Multi Combo Box component with which I pass an array of objects (key: value). In this array I will have the list of elements that are checked. This list will now be available in the component.
So when loading the Multi combo box I would like to check which of the elements in the list must have the check on true (internalProps.tokenList - “selected == true”)

This is the formula I wrote to compare the item in the list with a static value:
MAP (internalProps.tokenList, item.token === “PLACES”? {Token: item.token, selected: true}: {token: item.token, selected: false}) and this works.

Instead I would like “PLACES” to be obtained from the array that I pass through the new property. It looks like this:
[{token: “PLACES”}, {token: CHARACTERS}, etc …]

Would you help me understand how to do it?
Thank you

I came up with this formula and it works:
MAP (internalProps.tokenList, IS_IN_ARRAY_BY_KEY (internalProps.checked, “token”, item.token)? {Token: item.token, selected: true}: {token: item.token, selected: false})

internalProps.checked is a list of objects with a property (token - text).
If that can help someone else.

Have a pageVar for the entire list of token available.
And have a pageVar “tokenList” with something like for specifically the selected tokens:

Set both pageVars after their respective, relevant Get Record on page focused.
The assigned value for tokenList var should be along these lines:
MAP<item>(outputs["get whatever name of your data resource"].record.tokenList, { category: MAP(item.category, {selected: true, token: item.token}) })

Then in the list of options of the component:
MAP(pageVars.entire-list-of-tokens, IF(IS_IN_ARRAY_BY_KEY(LOOKUP(tokenList, "category"), "token", item.token), {selected: true, token: item.token}, {selected: false, token: item.token}))
(‘category’ is my list of objects with token and selected - yours is different)

You’re onto an extremely complexe, buggy component that does not work in repeat mode.
I’ve been working on it for a month and half (yes, 6 weeks) and I didn’t figure out the final update step work (when a user decides to change the selection, which should update the selected values in the database).

Hi @Fred_Kuzyk , I’m not sure I understand your message but I’ll tell you what I can do in my app using the Multi Combo Box component:

page 1 (red tags): the user can choose between various categories present in the combo box (the categories are dynamic and retrieved from the DB), then stores the data.

page 2 (blue tags): the user can view all the information previously stored through page 1 (including those entered in the combo box - categories -) - the information in the combo box is automatically retrieved from the db of course. The user can then modify all the information (even those in the combo box) and save them on the DB.

Everything works fine at the moment, based on the tests I’ve done.
I didn’t understand if this is similar to your use case, but if I can I try to help you. let me know

So this is for page2, for retrieving the tokens from the DB?

no, this decides which elements of the list to turn on or off based on what is reported in the DB, but for this to work you need to make some changes within the logic of the component

Claudio, when you have time, I’m curious to know how you set this up. My set up works, except when the component is inside a repeated container. Specifically, which edits in the component and which formula?

Hi Fred,
first I added the “checked” property variable to the Combo Box component and set it visible in the “advanced” section

Now I can send as a parameter to the multi box component a list of the elements that are checked on the DB

I then modified the original block of the component of the TokenStatusList private variable (this contains all the information of each single item, including if it is on or off)

I replaced the original formula with my own:

where I compare the internalProps.tokenList (which contains the list of items in the list) with my list of checked items (passed as a parameter (checked in 2nd screenshot)). If there is a match then it turns on the item in list.
That’s all!
I hope I have been clear and have been helpful to you. bye :slight_smile:

1 Like

Thanks for taking the time, let me digest this first and get back to you then… :stuck_out_tongue: