I have a master data table. I am filtering the data with unique column value and now i have a filtered DT.
I am looping through the filtered DT and performing some activities on the values. Based on the outcome i need to update the column value of that particular row.
How to ensure that the value is updated in the master data table as well.
Hello @ramya_anbazhagan ,
Can you send the dummy data of how the input and filtered data looks like, so that I can be more clear on your query.
Regards;)
I am filtering the master data table with unquie transaction code, for example my filtered DT is as below,
Now i am looping through this filtered DT,
If the transaction amount is greater than 10000, i am updating the Transaction status as “Valid” or updating it as “invalid”
The current row which i am looping is inside the filtered DT, but how can i ensure the same value is getting updated in the Master DT as well?
I understand your query. But the example i have provided is just for the understanding.
My business case is like, i will get some of the output values only when i loop through the filtered data table.
Example, i will login to the SAP system and will download the files related to that transaction, and i need to get the count of the no of files downloaded and then update it to the master DT.
It is not as straight forward as the above. Please find the samples updated below,
Master data table
Filtered DT
Once after i loop through each row and download the relavant files, i will have a the count of number of files downloaded for that particular row,
In this case, how can i update the values in the same rows of master DT.
Hello @ramya_anbazhagan ,
So for instance, in the master tables Transaction status column of other rows than AMK, will be left blank since it is not there in filtered DT, Am I right?
Regards;)
Hello @ramya_anbazhagan ,
I have attached the Code According to your Requirement:
(from row in dt_Input
let x=if(dt_Filtered.AsEnumerable.Any(Function(x) x("Transaction Date").ToString = row("Transaction Date").toString AndAlso x("Transaction Code").ToString = row("Transaction Code").toString),if(CInt(row("Transaction Amount"))>10000,"Valid","Invalid"),"")
Select dt_Input.Clone.Rows.Add(row.itemarray.take(3).Concat({x}).toarray)).copytodatatable
On the left hand side use your Master DataTable Variable, so that it can assign the values to the Master Datatable.
The output will look something like this:
I hope this Helps you out. Please mark me as a solution as this can help me too.
Regards
Akshay B;)
Hello @ramya_anbazhagan ,
For the Step 1 you can do the GroupBy method in Linq based on the Columns according to which it should be unique:
If you could give me the Demo data according to which column it should be unique, I can help you with the step1
Regards:)
Your DataTableName.Select.Where(function(x) x.Item(“column name”).ToString.Contains(“value to be matches”).ToArray(0).Item(" paste column name which has to be updated")) = “put value over here which to be updated in that column”