Remove last 4 characters of String and convert to integer

,

Working on a BPM to strip the last 4 characters from a string and then convert to an integer.

525012-NRW is the string and in field OrderHed.PONum I would like it to be 525021 as integer and put the code into a variable in the BPM.

This will be used to link back to a sales order number. Thanks in Advance

This is to remove characters.

This is to parse the string to an integer.

Tried to figure it out from the links but did not find anything that helped.

Here is what I have now but it is exactly opposite of what I want. It returns -NRW but that is what I want dropped.

ttOrderHedRow.PONum.Substring (ttOrderHedRow.PONum .Length -4)

image001.png

ttOrderHedRow.PONum.Substring (ttOrderHedRow.PONum .Length -4,4)

Try that.

Actually the link has Remove instead of Substring

ttOrderHedRow.PONum.Remove(ttOrderHedRow.PONum .Length -4,4)

Well that did not seem to make a difference.

image001.png

Or with SubString,

Now to convert that to an integer and we have got it.

1 Like

Got it ! Thanks to the Ninja !!!

image001.png

1 Like