Reformatting text in Data Table

Hi Guys,

I’m looking for a way to reformat 2 columns in my data table. One is province, the other is country. My logic so far is a for each row activity with an if statement that will iterate through the specific columns to check for the format rule.

the rule I’m trying to create is,
IF Country = “Canada” then write CAN
IF Province = “Manitoba” then write MB
IF Province = “Quebec” or QC then write PQ
IF Province = “Newfoundland” or NF then write NL

beginning: for each activity of the data table

example: decision tree iteration for country

sorry for the pseudo code, my syntax for uipath isn’t the best.



You can utilize switch activity. Please refer the below example.

Expression: strArray.FirstOrDefault(Function(s) url.Contains(s))
StrArray: Patterns to be found are given in the string array.
Cases: For each pattern, necessary activities need to be given
Switch Case type must be string.(found in the properties pane)


Hope it will be useful for you.

Saranya K R

do you mind clarifying the logic as to why i would use this function?

here is my logic so far for country

for each iterates through the datatable

not sure about the syntax here

i get this error here

write over cell with Canada with CAN


First all the values need to be stored in a string array of province values. e.g “manitoba”, “quebec”.
Take a switch activity and give the expression as
strArray.FirstorDefault(Function(s) province.contains(s))
Then write the cases,
Write Line - MB
quebec etc
Write Line - PQ

Hope it helps to understand better.