in an excel file there are two keys. Some combinaitons are allowed others not. In the first step I filtered the file so I get only the combinations that aren’t allowed - that works fine. Now I want to change the keys, so the combinations are allowed.
In the following I want to change the combination Key 1: S and Key 2: B. So if Key 1 is S AND Key 2 is B then I want to change Key 1 to “SA”.
I used the “For Each Row” Activity and the following If-Condition: row(“Key 1”).ToString.Equals(“S”) And row(“Key 2”).ToString.Equals(“B”).
In the THEN-Condition I used a Assign-Activity. I think that’s where my program doesn’t work anymore.
I used the following: row.Item(“Key 1”) = row.Item(“Key 1”).ToString.Replace(“S”, “SA”).
Can someone help me? I am very grateful for every tip!
@cathschaen In your workflow your updating values to datatable, but not writing again back to excel file and also in if condition use trim method like below. It will be useful if values contains space before or after the string from next time onwards.
row(“Key 1”).ToString.Trim.Equals(“S”) And row(“Key 2”).ToString.Trim.Equals(“B”)
Check below for workflow and output file(final output is written in sheet1)
@Manjuts90 Thanks for you help. I have another quick question. I want to change every Key 1 doesn’t matter what the content of Key 2. I tried to do it with a wildcard (* and ?) but that doesn’t seem to work, do you have an idea?
row(“Key 1”).ToString.Equals(“S”) And row(“Key 2”).ToString.Equals(“*”).