Convert table

Hi, I’m all trying to convert a column called Unit that has values of type string into integer values Example
Unity
EA to be converito in 1
BX4 Must be converted to 4

Thanks for your help

Hi,

You can do this using regex,
Create a variable matchValue as Match datatype then in an assign activity use the below line
matchValue = Regex.Match(“yourInputString”, “\d+(?:[.,]\d+)*”)

1 Like

Hi @cristian_urrego,

if I understand correctly you have different values (EA,BX4, XX, etc) and want to convert them to an integer?
If so then I would use a switch-activity with the type string.
The cases would be your Units and in the cases you can then assign your values - even write them back into the datatable if that makes sense in your case.

Sorry I did not understand the sentence so I do not know how I can use it.

If correct, the column has different values
of chain which correspond to a number

this would be the way of excel

image

If the number in the column (BX2, BX4 etc) is corresponding to the number you want, then you can use @sarathi125 solution!

If there are other values where the number is not corresponding to the values you need to assign please look into the switch-activity.

But I do not understand the solution she says. Can you explain to me what a pity