Hi,
I am a beginner and currently enjoying a lot to learn UI Path
I am reading a DataTable from an excel sheet. In a “Each Row” loop im reading the values within the column “EType”. In case a value contains the string “Meal”, value need to be replaced with “Meals”.
I have created an assignment activity with the below logic. No errors are split out - However, after looking at the output file the values were not replaced.
any ideas where the problem is? The replace function in an if else statement works perfectly if i not using the LIKE operator.
If(Convert.ToString(row(“EType”)).Equals(“LIKE ‘%Meal%’”), Convert.ToString(row(“EType”)).Replace(“LIKE ‘%Meal%’”, “Meals”), Convert.ToString(row(“EType”)))
My second question:
Can i add a new if else statement on a different column using the OR function? So i dont need to create multiple assignments for every case where values needs to be replaced. Below an example which doesn’t work unfortunately
If(Convert.ToString(row(“EType”)).Equals(“Breakfast”), Convert.ToString(row(“EType”)).Replace(“Breakfast”, “Meals”), Convert.ToString(row(“EType”)))
OR
If(Convert.ToString(row(“EType”)).Equals(“Dinner”), Convert.ToString(row(“EType”)).Replace(“Dinner”, “Meals”), Convert.ToString(row(“EType”)))
OR
If(Convert.ToString(row(“XYZ”)).Equals(“Hello”), Convert.ToString(row(“XYZ”)).Replace(“Hello”, “Whats up”), Convert.ToString(row(“XYZ”)))
Thanks in advance!