Removal of just a part of a DataTable value

I’m extracting some data from SAP but the value comes like this

COP 432.446,35

I’m trying to remove the "COP " part and get just the number but leave it in the same position of the Dt

any ideas?

Hello :wave:

Can you try this.

Insert For each row activity

  • for your datatable. Say “dt_1”
    Insert IF Activity
  • With the condition. Row.item(“INSERTCOLUMNNAME”).tostring.contains(“COP ”)

Then Branch (within IF Activity)

Insert Assign.

Left Assign:
Row.item(“INSERTCOLUMNNAME”)

Right Assign
Row.item(“INSERTCOLUMNNAME”).Tostring.Replace(“COP ”, ””)

This should update the values in the column.

Just update the capital letters with the name of the column.

Hopefully this helps.

Cheers

Steve

For Each r as Datarow in DT.Asenumerable
r(“Col_Name”)=Regex.Replace(r(“Col_Name”).Tostring,“^COP\s+”,String.Empty)
Next r

Try this with invoke code.

Worked like a charm, thanks

1 Like

The solution above worked but I’ll try this one too

Tried, got DT not declared error even tho I changed the datatable name to DT, also got Regex not declared error

If your problem is solved - please mark as solution so others will find it (it will have a green tick when searching).

If you are still exploring solutions atleast you have a backup :slight_smile:

Cheers

Steve

1 Like

Done, thank you for the solution

Cheers

Daniel

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