Can i use list of array in filter data table Values? To check OR condition?


I want to filter one column with all 2 to 4 conditions , is that possible?

@MitheshBolla

It’s not possible.

1 Like

hmm,ok bro

You may have to convert array to datatable to achieve this

1 Like

all my values should be of data type Datatable?

@MitheshBolla

Check the PPR solution in the below thread. It might help you.

Using Build Data Table create the table first.

then use add data row ->Properties → ArrayRow pass your string array.

use this to convert array to datatable

1 Like

Maybe LINQ approach will serve

dtFiltered =
(From d in dtData.AsEnumerable
Where arrValues.Contains(d("USCIS Case Status").toString.Trim)
Select r = d).CopyToDataTAble

looking full value match

2 Likes

implementint a contains on the arrayitem to the data column value we would do:

dtFiltered =
(From d in dtData.AsEnumerable
Where arrValues.Any(Function (x) x.Contains(d("USCIS Case Status").toString.Trim))
Select r = d).CopyToDataTAble
1 Like

Actually , i had One Excel . it contains 20 columns and 100+ rows of data.
i need to filter on status column and then cut it and paste it to that respective sheet. i have 4 status , pending,approved,denied,withdraw.will that be possile with this expression?

in the expression arrValues is your array of statuses
arrValues = {“pending”,“approved”,“denied”,“withdraw”}

1 Like

actually pending ,approval , denails are different sheets. i need to filter in main sheet if Status column contains (Approved, approve,case was approve, success ,passed) then i need to move to Approval sheet.

@MitheshBolla Since you have only 4 conditions I guess you can write separate conditions for each status. Even if you filter all the status at once you have to filter from it again to get the required status

Steps:

  • Read excel data to data table (DT)
  • Now filter for status Approved (from DT) and write the data in a excel or you can store in the data table (DT1), finally you can write an excel
  • Now filter for status “Success” (from DT) and write the data in a excel or you can store in the data table (DT2), finally you can write an excel
1 Like

In main sheet i have 100+ status, but those i need to classify to 4 sheets.
Approval
Withdrawn
Denial
Pending.

in main sheet if status is (Approved or approve or case was approve or success
or passed) then i should move to Approval sheet,.

As u told i used filter data table and keept this conditions . but instead of adding these status in filter data table , can i use excel in storage bucket , so that later new status may come and changes will not be in bot?

@MitheshBolla

  • You have to use the filter data table activity any way to filter the required status. But as like you mentioned you can keep all these status in an excel or notepad and can store in a storage bucket
  • Every time when the bot runs you have to read the data from the storage bucket first
  • Now, retrieve each status and pass to the filter data table activity. If you are implementing this case then one filter data table activity should be enough. Every time you can pass the status name dynamically into filter data table

FYI - The output of storage bucket is string.You might have to perform some string operations to get the different status stored in that storage bucket

1 Like

Hi @MitheshBolla ,

If you are concerned about the variation of values that would be entered for Approval Status or other Statuses involved and would need to update them as received, you could use an Excel for this Purpose and Upload it to Storage Bucket.

The Excel maybe you could keep in the format as below :
image

Then Download the Excel from the Storage Bucket. Read it. Loop through the Columns one by one, thereby picking up it’s column values, converting it to an Array and using the Solution as above provided by @ppr for Filtering with the list/array of values.

We should then be able to Write the Filtered Datatable to Separate Sheets.
Note that, the Column Headers are the Sheet Names to be created.

Let us know what is your opinion on this, and if you need further help.

1 Like

The thing u explained was my clear requriment.ill implement this, one conditon to be checked, that is

If id =“101” status= “approved” i need to cut from main sheet and add this row in approval sheet,
before adding this i need to check if Id=“101” already exists in approval sheet.

if id not present in approval sheet ill cut from main sheet and add append in approval sheet.
if id is already present then i should delete from main sheet .

Bro can i have this expression in C#

bro can i have

(From d in dtData.AsEnumerable
Where arrValues.Any(Function (x) x.Contains(d(“USCIS Case Status”).toString.Trim))
Select r = d).CopyToDataTAble

this in c#

let’s start by this

(from d in dtData.AsEnumerable()
Where arrValues.Any(x => x.Contains(d["USCIS Case Status"].ToString().Trim()))
Select r = d).CopyToDataTable();

And keep in mind that in some scenarios also correct statements will not validate due some internal issues (C# combination with UiPath.System.Activities at certain version level in combination with some targetframeworks).

1 Like