How to select checkboxes based on DataTable values in UiPath?

Hello,

I am developing a solution in UiPath where I need to handle approximately 500 entries (essentially a list of suppliers). Each supplier corresponds to a checkbox in the application.

From my input DataTable, I am retrieving the value with:
CurrentRow.Item("Supplier").ToString

What I need is to instruct the bot to select the checkbox that matches this specific supplier name during each iteration.

In another post I saw that it is possible to attach the value to be selected inside the UI element’s aaname attribute. Is this approach valid, and if so, how can it be implemented properly?

  • Is there a recommended way to dynamically match the value from the DataTable with the checkbox’s label?
  • Should I rely on a dynamic selector with the supplier name, or is there a better approach to ensure reliability when dealing with so many checkboxes?

Any suggestions or examples would be greatly appreciated.

(This is how my list of checkboxes looks like)

Thank you!

Hi @yairb17109

You can consider below approaches..

  1. if your requirement is to only tick 1 check box at a time based on the supplier’s name in 1 full iteration… then you can have explore the ui element of your check box and have its label/aaname or inner text dynamically refer to value - CurrentRow.Item(“Supplier”).ToString

  2. but if your requirement is to go through a list of items in datatable and check them all one by one in that loop, then you can consider using for each ui element activity where you can include an if statement chekcing if current element’s lable is equal to value - CurrentRow.Item(“Supplier”).ToString then tick the check box else proceed to next supplier in the datatable.

Hope this helps.

Regards
Sonali

Hi @yairb17109

Pls check below link,

Happy Automation

Use anchor based selector with click acitivity where anchor attributes matched with your datatable Val, based on you requirement you can fine tune the for each row in datatable acitivity.