Arrays and scalar datasource manipulation

are collections (arrays) scalar datasources, and thus have scope only in the webform to which they are passed by a function?
i have a collection bound to a data table. i did this instead of using an entity selection because i wanted to add a column, called “selected”, which indicates that a corresponding row in the collection is selected.
if i want to change that property, do i have to send the entire array back to the server in a function handler so it can modify that one row, and then send the entire array back to the browser? a shared/namespace collection is a problem if more than one user is logged in.
i suppose i could assign the collection to the session (but it is still a shared collection, just with a session scope instead of a namespace scope), but then the server still has to send the entire collection back to the browser to render the change.

sending the entire collection to the server (and then back) works, but it is really slow.

Hi mikey,

You’re use case is interesting.
I guess a multiselect feature in datatable / matrix would be helpful in your situation.

are collections (arrays) scalar datasources, and thus have scope only in the webform to which they are passed by a function?

yes, collections/arrays datasources are local to the webform they are created in. Unless you place them in a namespace.

a shared/namespace collection is a problem if more than one user is logged in

Why is that? I you refer to shared/namespace datasource, it is just shared among webforms, not among users.

Another way around, not using a collection but keeping your original entity selection, is to use another entity selection where you populate selected rows. Have a look at the Entity Selection / Collection demo (available for sandboxes and as a 4D PICS). But perhaps doesn’t it fulfill your UX requirements.

I’ll work on something else that might be a better option, but more time needed.

multiselect would make this thread/hack a footnote.

1 Like