cristianivanoff
Technical User
Hello all,
I would like to extract all numbers from a string. I have a field {TM_SE_sbreg.Reference} that can have these strings:
's-12344','r-se-123456','r-se-123455-3'
I need only the numbers that is: 12344, 123456, 1234553
I made the following formula:
if {TM_SE_sbreg.Reference} startswith "s" or {TM_SE_sbreg.Reference} startswith "r" then
if {TM_SE_sbreg.Reference} startswith "s" then tonumber(replace(mid({TM_SE_sbreg.Reference},3,len({TM_SE_sbreg.Reference})),"-",""))
else tonumber(replace(
mid({TM_SE_sbreg.Reference},6,len({TM_SE_sbreg.Reference})),"-","")
else 0
This work fine, but if I want to do a sort I get the following message: 'The string is non numberic'->tonumber(replace(mid({TM_SE_sbreg.Reference},3,len({TM_SE_sbreg.Reference})),"-",""))
Anybody have suggestion how to solve this?
Any help is appreciated.
Br
Cristian ivanoff
I would like to extract all numbers from a string. I have a field {TM_SE_sbreg.Reference} that can have these strings:
's-12344','r-se-123456','r-se-123455-3'
I need only the numbers that is: 12344, 123456, 1234553
I made the following formula:
if {TM_SE_sbreg.Reference} startswith "s" or {TM_SE_sbreg.Reference} startswith "r" then
if {TM_SE_sbreg.Reference} startswith "s" then tonumber(replace(mid({TM_SE_sbreg.Reference},3,len({TM_SE_sbreg.Reference})),"-",""))
else tonumber(replace(
mid({TM_SE_sbreg.Reference},6,len({TM_SE_sbreg.Reference})),"-","")
else 0
This work fine, but if I want to do a sort I get the following message: 'The string is non numberic'->tonumber(replace(mid({TM_SE_sbreg.Reference},3,len({TM_SE_sbreg.Reference})),"-",""))
Anybody have suggestion how to solve this?
Any help is appreciated.
Br
Cristian ivanoff