Iterating through checkboxes to ensure correct states, how to do this?

Hi all,

I’ve created a xaml where you can supply inputs to click on which of the checkboxes desired from this site How To Create a Custom Checkbox and Radio Buttons

To ensure that only the desired checkboxes are selected I first uncheck them all. However I do this in a poor way - by simply having a string array with the names of all the checkboxes.

I realise that this leaves me open to all sorts of problems - e.g if another checkbox is added to the list.

From looking at the forums and trying to understand the logic required, I believe that I need to use the get child action and return how many checkboxes exist, and loop through these and uncheck them all, verifying that this has been done and then move on to checking the ones I want.

I don’t really have a clue how to do this. Please can I ask if anybody can look at my xaml and see if they can add these steps in for me/talk me through on to do these?

CheckBoxes_RadioButtons - Copy.xaml (11.3 KB)

Appreciate it’s a big ask, but would be a massive help and a big learn for me.

Thanks
Jordan

1 Like

Hi @jordrowley

I will check and let you know ok?

~Diego Turati

Hi @jordrowley

I couldn’t change all your flow, but, i did some adjustments in the xaml file below that you select os unselect checkboxes i believe that’s what you’re looking for:

CheckBoxes_RadioButtons - Copy.xaml (19.6 KB)

In order to fix and make it work you need to check how these objects appears in the HTML code.

I saw your array was containing string such as {“one”,“two”, etc}

I just changed it to {“1”,“2”,etc) and then removed the "Check activity to “click” activity.

The trick here is work with dynamic selector in order to make it loop through your array and unselect objects you want.

Check it below :

If it helped you, please, mark this post as solution in order to help UiPath Community.

Doubts, let me know!

Happy automation!

~Diego Turati

1 Like

@DiegoTurati first of all, thank you so much for doing this for me. Very much appreciated.

I wasn’t in the office much yesterday and have meetings today so I still won’t get chance to have look, but as soon as I can I will and let you know how I get on.

Also, my team leader says she is going to help me with looking at child elements in respect of this ‘issue’ so I will share any output xaml on here in case you get any benefit from this.

Thanks again, I will report back soon.

Jordan

1 Like

Thanks @jordrowley!

~Diego Turati