Filtering the datatable1

Hi All,

Good Afternoon.

I need to filter a column the name of the is “D” the conditions are:

  1. Filter the “D” column with “C”(Credit) keep “C” related data , and delete the “D”(Debit) related data.
  2. Filter the “D” column with “D”(Debit) keep “Debit” related data , and delete the “C”(Credit) related data.
  3. At the end need to select both. I meant I am trying to separating the credit and debit column(FCY_AMOUNT) in debit column there should be only debit related data and credit column(LCY_AMOUNT) should contains credit related data.
    Please Do needful.

Thanks,
Naveen Kumar S



Screenshot 45-Output after filtering as said.
Screenshot 46-Input file

Hi @HeartCatcher
you can try this way

  1. Read the excel and store in dt1 datatable variable

2.Now use filter datatable activity or u can use linq query for your cases

dt2=dt1.AsEnumerable().Where(Function(row) row(“D”).ToString.Trim.Equals(“D”)).CopyToDataTable

dt3=dt1.AsEnumerable().Where(Function(row) row(“D”).ToString.Trim.Equals(“C”)).CopyToDataTable

Write dt2,dt3 in seperate sheets

dt2==> Debit

dt2 ==>Credit

Regards,
Nived N

Hi @NIVED_NAMBIAR
Thanks for your reply but I need both the credit and debit in the same page.
not in different sheets.

Best Regards,
Naveen Kumar S

Same page means ?

I mean the output of dt2 and dt3 should write in same sheet not in different sheets.
thanks.

Like dt2 after dt1 should be written in same sheet , right?

Yes, Correct

So try this way

  1. after getting dt2 and dt3, use merge datatable activity to merge both and write into other sheet

OR

  1. Write the dt2 in sheet using write range, then use append range to append the dt3 in same sheet.

Regards,
Nived N

Ok, thanks for your response.
I want to learn Linq query can you guide how to start with.

Regards,
Naveen Kumar S

Hi Naveen,

For learning Linq query

You can refer many sources

Regards,
Nived N

1 Like

Hi @NIVED_NAMBIAR ,
Thanks for your reply and concern.

1 Like

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