Please I need a way I can Update a value in a Specific cell of a row based on the condition of a value in another specific cell of another row all in the same Datatable.
For example lets say I have a datatable having 3 columns(Account, Currency and Debit Amount), the column(Currency) has 3 currencies underneath it USD,NGN and NGN. So I want to update the Debit Amount of the first occurrence of Currency NGN By multiplying it by 2 if a row with Currency USD is present.
How to Update a value in a Specific cell of a row based on the condition of a value in a specific cell of another row
Please see the atatched xaml… In here I have shown how to do this by creating what you asked.
Sequence1.xaml (13.4 KB)
Can you try clicking on Convert on top. If that doesnot work I will give you another xaml
i tried that, didn’t work
This is what it contains
first if - dt.AsEnumerable.Where(function(row) row(“Column1”).ToString.Equals(“NGN”)).Count>0 And dt.AsEnumerable.Where(function(row) row(“Column1”).ToString.Equals(“USD”)).Count>0
second if - dt.Rows.IndexOf(dt.AsEnumerable.Where(function(row) row(“Column1”).ToString.Equals(“NGN”))(0)) < dt.Rows.IndexOf(dt.AsEnumerable.Where(function(row) row(“Column1”).ToString.Equals(“USD”))(0))
second assign left side dt.Rows(index)(“Column2”)
you are using windows -legacy please dont use that its a older version
while creating process please select this option as below
Hope this helps. If not let me know I will recreate using old version
Hey thanks for your help, but how will i know if it worked. There is no output activity like a write range or a write line
At the last please include a log message and pass dt.rows(index)(“Column2”).Tostring
This will print the same row that is modified in the assign
Thanks!.. it worked. So please how can i now get the index of the Updated Amount, so that i can write it back to the cell.
You have the row index already in index variable add 1 to it will give you the excel row value.
And you already know the excel column as the column would not change just append both of the together to get the cell value and use it in write cell
Say your column is B then B+(index+1).ToString is your excel cell value
Hope with this you resolved your issue
Please let me know if its sorted else happy to give more info.
If you see appropriate solution please mark it to resolve so that others can also get help
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.