Adding additional value to existing ones

I have a data table with values ranging from 1 to n. How do i add “M” in front of each value and also a zero for the single digits so it appears like

M01
M02
...
M10
M11
...
Mn

The number of rows is not fixed and there is a second column of data, if that is a concern to take note of.

2 Likes

@Zac_Soh

  1. use Read Range activity to read the data from Excel file and will give you output as DataTable and say ‘inputDT’.

  2. And then use ForEach Row activity to iterate that DataTable.

        ForEach row in inputDT
           If row("ColumnName").Tostring.Trim.Length = 1
            Then row("ColumnName") = "M0"+
             row("ColumnName").Tostring
             Else row("ColumnName") = "M"+
             row("ColumnName").Tostring
    
  3. Finally use Write Range activity to write into Excel file.

5 Likes

@Zac_Soh, You may find following thread helpful.

1 Like

@lakshman
Thanks! That solved my problem perfectly

2 Likes

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