How to assign filtered table results to Exisiting Table

Hi

I have a table DT_TempInTable(read from excel spreadsheet).
For each Row in DT_TempINtable
filter table by some condition-stored to DT_Tempouttable
For Each Row in DT_TempInTable
filter by some condition-store the result back to DT_TempinTable

Here result is stored to DT_TempINTable but when the loop comes to the main for loop ,the last stored data in DT_TempInTable is not shown rather the left over of the first loop is seen.Is there any specific syntax to assign the table?Please advise.

Hi @amr07

Can you attach a workflow?

Please try to use output datatable activity and see are you getting the desired result in TempInTable

Thanks,
Prankur

Thanks for the reply.sorry i cant attach the workflow…due to compliance issue.I am getting the desire output in TempinTable as i can see the row,col value in locals pane.

Also, can you please check the scope of variable TempInTable?

its accessible across the flowchart

Okay no issues, so you can try to debug this -

  1. In For each loop use Write Line activity and write whatever you are filtering just to make sure correct value is going into the table.
  2. Try to output datatable at desired place so as to make sure table variable has the value
  3. You need to debug it step by step so that you can see where it is failing

Thanks,
Prankur

Values populated is correct till it comes to main for loop.Once it reaches the Main for loop it takes the previous left over value of TempinTable.

Thanks
Aravind

You can use clear data table in that case

attached workflow here with some masking.Please advise.

Regards
sample.xaml (84.1 KB)

getting the error “Collection was modified;enumeration operation might not execute” when clear data table is used.

scrnshot

Looking at your workflow it seems you have filtered same table i.e base datatable multiple time which is DT_TempInTable and you final result is stored in DT_ResultantTable

So do you mean you are not getting value in DT_ResultantTable?

Also, i do not see your workflow assigning back in the base table

image

this one, instead your final table should be ResultantTable

It would be easy for you to understand the flow if you use Workflows it will keep the code clean and organized and then you can Invoke workflows wherever you want

Thanks,
Prankur

2 Likes

Basically once i use the data in resultant table ,i need to loop back to the Tempintable where i am removing all the rows which i have iterated at the begining of the for loop,eg:say remove rows which contains value “Apple”.The output after this filteration is stored into a newtable which is stored back to TempIntable and so on the process continues till the rows are zero.Hope am clear now.