How to change value of existing row and column in a data table

datatable
activities

#1

change the value of existing row belonginging to a particular column .and not adding data row.but changing existing value of a datatable


Changing a row of a datatable iwth a given condition
#2

Here is a basic example on how to change the value of an existing row:
example.xaml (11.6 KB)


Calculate average of similar rows cell in Excel
#3

Hi Thanks a lot.and also can you help based on if condition then I have to change the value of only those row.how can we do it?


#4

Hi!
You can use a For each row activity and then a If with your condition.
There are several examples in posts here. Just search “Filter datatable” or “Filter excel” and you will find plenty.

It depends on your condition really. For example you can check if the datatable is not null isNothing(yourdatatable) first and then iterate through all the rows and have another condition with some other actions.

If you have a specific condition maybe I can answer more specific.


#5

Thanks a lot.it worked!


#6

An even quicker method can be to use “DataTable”.Rows.IndexOf(“DataTable”.Rows.Find(“String”)) to find the first occurrence of a string. Removed the lengthy iteration through all rows. But I believe this only works if there was a primary key defined for the DT.