I am using Studio 2023.10 with package UiPath.Form.Activities = 23.10.4
On a form, I want checkboxes which are generated in runtime, depending on a list of items.
The item names and the number of items are depending of a list of items, which is filled in previous code. The number of items will never be more than 16.
Example:
When the user pushes the button Submit, then I want to have back the list of the checked items.
I have done this in a previous (old) version of form activities (package 2.2), but in the new version I don’t find the right way to do this.
Sequence
Variables
items (List) - Initialize with your list of items
selectedItems (List) - Initialize an empty list to store selected items
Assign activity
yourForm = Create Form
For Each activity
item In items
Add Form Element
Type: Checkbox
Label: item
Add Form Element
Type: Button
Label: Submit
On Click
Assign activity
selectedItems = GetSelectedItems(yourForm)
Log Message
Text: "Selected Items: " + String.Join(", ", selectedItems)
Function GetSelectedItems
Arguments
form (Form) - Input form
Variables
result (List) - Initialize an empty list to store selected items
For Each activity
checkbox In form.GridContainer.Children
If checkbox is Checked
Add item to result list
I think it is not possible yet to do that in the new forms (studio 2023.10 with form activities 23.10.5). I have raised a ticket to UiPath support.
KR
Johan