How to add filters for 2 colomns in excel

Hi,

I have excel with different coloumns data …i want to filter the data based on two coloumns .How to do that?FYI…attched is the input file

INPUT :

the filters have to apply on Expenditure type and task type

Thanks

Hi @cheersrpa ,

  • Retrieve the data from excel using read range activity. The result will be a data table, dt1.
  • Apply select filter on required columns-
    dt1.Select("[Expenditure Type]=‘bbc’ and [TaskType]=‘CD’")
  • The result of above query will be array of DataRows, arDataRows
  • check if Length of array > 0 => results exists, (not arDataRows is nothing and arDataRows.Length > 0)
  • if true, Convert array of datarow to DataTable, dt2 = arDataRows.CopyToDataTable()
    Result of this will be a datatable.

Hope this is helpful.

1 Like

even before i tried the same logic…the result is data reader i want the output as data table so that i can write it in another excel sheet

Updated the steps in above post. Please check. Now the end result will be a datatable.

if you can send .XAML file,That will be great to understand madhavi…

Thanks again

@cheersrpa

i haven’t created workflow. You send me your workflow with your understanding. i will review and correct it if required.

I am getting below error

Assign: Syntax error: Missing operand after ‘Std’’ operator.",
here is my code

You might have directly copied the code and then changed the values. Manually remove ’ from the query and add it again.

Be careful about the quotations:

dt1.Select("[Expenditure Type]=‘bbc’ and [TaskType]=‘CD’")

versus

dt1.Select("[Expenditure Type]='bbc' and [TaskType]='CD'")

The second one should work.

3 Likes