Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Seperate the numbers from a string

Status
Not open for further replies.
Jul 28, 2011
167
NG
Hi all,
I want to be able to seperate the numbers from the alphabeths in a string.
E.g 30d should be seperated as 30 and 120yyy should be seperated as 120 and yyy.

I was able to do this in sql but cant implement it in CR10

Does anyone have ideas

____________________
Men put up a strong face just to cover their weaknesses...good!
But a smile makes them live longer....
Which would you choose?

Think about it.
 
Assuming your filed always has format
number/text or text/number, create two formula

Code:
@splitNum
whileprintingrecords;

global stringvar num:='';
global numbervar l:= 1; 


While l <= length({v_LiveBonds.BND_BranchReference}) do
(
If isnumeric({v_LiveBonds.BND_BranchReference}[l]) then num:=num+{v_LiveBonds.BND_BranchReference}[l];

l:=l+1;
);

tonumber(num);

Code:
@splitTxt
whileprintingrecords;


global stringvar txt:='';
global numbervar l:= 1; 


While l <= length({v_LiveBonds.BND_BranchReference}) do
(
If not(isnumeric({v_LiveBonds.BND_BranchReference}[l])) then txt:=txt+{v_LiveBonds.BND_BranchReference}[l];

l:=l+1;
);

txt;

Ian

 
Sorry replace my field names with yours ;-)

Just did a quick test of my logic.

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top