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

Hi Guys,
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.

Hi @Anifowose_Temi

Please see the atatched xaml… In here I have shown how to do this by creating what you asked.

Sequence1.xaml (13.4 KB)

cheers


Hi, i got this error msg loading the xaml

Hi @Anifowose_Temi

Can you try clicking on Convert on top. If that doesnot work I will give you another xaml

cheers

i tried that, didn’t work

Hi @Anifowose_Temi

This is what it contains

datatable


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))

two assigns


second assign left side dt.Rows(index)(“Column2”)

cheers

Hi @Anifowose_Temi

you are using windows -legacy please dont use that its a older version

while creating process please select this option as below

cheers

Hi @Anifowose_Temi

Hope this helps. If not let me know I will recreate using old version

cheers

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

Hi @Anifowose_Temi

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

Cheers

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.

1 Like

Hi @Anifowose_Temi

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

Cheers

Hi @Anifowose_Temi

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

Cheers

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