Multiple inputs to filter in excel

Excuse me. Now I am trying to build RPA to automate send e-mail by entering some conditions, but now I have difficulty in designing the multiple conditions.

For example, I have a client dictionary as following:
(the real case have about 400 clients)

No. Client Email address
1 A Company A@gamail.edu.tw
2 B Company B@gmail.edu.tw
3 C Company C@gmail.edu.tw
4 D Company D@gmail.edu.tw
5 E Company E@gmail.edu.tw

Now I would like to send emails to client A, D, and E. Therefore, I will enter 1, 4, and 5 by an input box.

And it would be available to send mails to client B and C if I enter 2 and 3 by an input box.

The function of filter data table seems to not achieve the result I want.

Which function or scrip should I use?
Thanks for your answer~

You need to use DataTable,Select method of .NET

eg:
image

@DannyChung

As far as I understand, you are looking for a way to dinamically filter the datatable, based on user input. This can be achieved through Regex.

  1. Input box: write β€œ1|4|5” β€”> filterStr

  2. Assign filterStr = β€œ^” + filterStr + β€œ$”

  3. Assign activity:
    dt = dt.AsEnumerable().Where(function(x) Regex.IsMatch(x(β€œNo.”).ToString.Trim, filterStr)).CopyToDatatable()

  4. For each row in dt β€”> Send emails.

:slight_smile:

1 Like

I am so sorry but it doesn’t work for the step 3.

It shows the wrong message.

Is the variable type of β€œdt” Data Table?

1595385726724

Sorry. Could you please describe more detail about the step and the Vb expression?

Thanks a lot.

Yes, dt is a datatable.

What’s the error that UiPath shows?

Find more about filter expression syntax here https://www.csharp-examples.net/dataview-rowfilter/

Check this below workflow, @DannyChung
Datatable_Filtering.xaml (11.7 KB) and Input file Filtering_File.xlsx (9.3 KB)
Hope this may help you :slight_smile:

1 Like

Thank you~

It works. :grinning:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.