How to remove filter DataTable and get entire list

Hello Everyone,
I have a DT which i need to apply different filters on it (update some values in DT after each filter).
now my question is, how to clear filter and get entire list again in same DT ? is there any way to do so ?

Thank you for your help.

1 Like

Hi @TheBestBirth

I would suggest that the you assign the filtered DT to another variable so that the current DT will remain unchanged.
With that, you have 2 variables with:

  1. Filtered DT
  2. Unfiltered DT

Hope this helps.

Thanks and regards!

5 Likes

Hi @Jan_Brian_Despi and thanks for your swift reply to this,
In this case , i will loose updated values in Unfiltered DT. how to get those info from Filtered DT to Unfirtered DT ? any solution for it which you can share with me ?

1 Like

Hi
–Once if we have filtered the datatable we wont be able to get back to the original one
–So its always good to have another datatable variable assigned with the original one in this case
–say if we have a datatable named dt1
then create another variable named dt1_filtered of type datatable, with default value of New System.Data.Datatable and use a assign activity to assign the original to it so that we can modify this new variable and whenever we want to original datatable we can make use of dt1

and for this

when we want unfiltered data we can use dt1 and if we want updated values that is filtered data we can get from dt1_filtered

Cheers @TheBestBirth

@Palaniyappan , Hi and Thanks for your reply.
if i understood you correctly, i assume i wont get updated values in dt1 ( Original one).
right ?

1 Like

Fine
lets take like this
–dt1 is a fresh one…we would have not updated it with any data
–so lets take it as original one
–now if we want any thing to be updated like any row and its data to be updated we assign our datatable dt1 to a new datatable named dt1_filtered, so that we can update now the new datatable

–and we can use this new datatable dt1_filtered which has got the updated values

Kindly correct me if i m still wrong with understanding the question and elaborate a bit more on the scenario we are in
Cheers @TheBestBirth

@Palaniyappan Well, i totally understand it works if we are talking about 1 filter.
in my case, i need to apply 50-60+ filter on Original one ( dt1) and update some values.
lets say, first filter would be on Col. “A” ( XX=10 ) and some cells will be updated. second filter would be on Col. “A” ( XX=20 ) and some others cells get updated. and so on…
now , how can i get all updated cells into original one ?
what i was thinking is to make temporary DT and after each filter , append Filtered DT to temporary one. , at the end, i will have updated list :slight_smile:
what do you think about this approach ?

1 Like

That would be good enough, we can give a try for this

Cheers @TheBestBirth

1 Like

@Palaniyappan
I will try this then :slight_smile:
can you please help me with something,
i can crate new DT and copy Original one to it. but how can i remove all rows and only keep header in new one without making loop etc. ? or i need to make a loop and remove rows one by one ?

1 Like

we can use CLEAR DATATABLE activity where pass the datatable variable as input
–once passed we will be having only the headers in that datatable and no records in it

Hope this would help you
Cheers @TheBestBirth

1 Like

@Palaniyappan
Works Perfectly fine :slight_smile: , exactly what i wanted.
Thank you !

Fantastic
Cheers @TheBestBirth

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