JimmyEdwards
Technical User
I'm trying to pick up a mobile number from a database, but the data is rather messy.
A lot of the number's have hash characters (#) at the end, and a lot also have a description of the number. I have worked around the first bit, but the text is causing me problems.
This is my formula:-
------------------------------------------------------------
StringVar Mobile :=
if ({Interface_TextMsg.Tel_No_To} startswith "07"
or {Interface_TextMsg.Tel_No_To} startswith "14107"
or {Interface_TextMsg.Tel_No_To} startswith "0 7"
or {Interface_TextMsg.Tel_No_To} startswith "128007"
or {Interface_TextMsg.Tel_No_To} startswith "147007")
then {Interface_TextMsg.Tel_No_To};
Mobile:= Replace (Mobile," ", "");
Mobile:= Replace (Mobile,"#", "");
If isnumeric(mobile) = false then Mobile:=""
Mobile:= "/DDD " & Mobile;
Mobile:= Replace (Mobile,"14107" , "07");
Mobile:= Replace (Mobile,"0 7", "07");
Mobile:= Replace (Mobile,"128007", "07");
Mobile:= Replace (Mobile,"147007", "07");
Mobile
------------------------------------------------------------
With a value of "07876 578236# Brother"
The reult I would like is "/DDD 07876578236"
Because of this line:-
If isnumeric(mobile) = false then Mobile:=""
I am getting "/DDD". I would like a way to remove the "Brother" bit of the valuem, but this text could be anything.
Hoep this makes sense, and thanks for your help.
A lot of the number's have hash characters (#) at the end, and a lot also have a description of the number. I have worked around the first bit, but the text is causing me problems.
This is my formula:-
------------------------------------------------------------
StringVar Mobile :=
if ({Interface_TextMsg.Tel_No_To} startswith "07"
or {Interface_TextMsg.Tel_No_To} startswith "14107"
or {Interface_TextMsg.Tel_No_To} startswith "0 7"
or {Interface_TextMsg.Tel_No_To} startswith "128007"
or {Interface_TextMsg.Tel_No_To} startswith "147007")
then {Interface_TextMsg.Tel_No_To};
Mobile:= Replace (Mobile," ", "");
Mobile:= Replace (Mobile,"#", "");
If isnumeric(mobile) = false then Mobile:=""
Mobile:= "/DDD " & Mobile;
Mobile:= Replace (Mobile,"14107" , "07");
Mobile:= Replace (Mobile,"0 7", "07");
Mobile:= Replace (Mobile,"128007", "07");
Mobile:= Replace (Mobile,"147007", "07");
Mobile
------------------------------------------------------------
With a value of "07876 578236# Brother"
The reult I would like is "/DDD 07876578236"
Because of this line:-
If isnumeric(mobile) = false then Mobile:=""
I am getting "/DDD". I would like a way to remove the "Brother" bit of the valuem, but this text could be anything.
Hoep this makes sense, and thanks for your help.