'The string is non-numeric' error in a crystal reports Formula

M

maddy2012

Guest
I have put a formula to display the value of a field after masking it in crystal reports. but it shows me an error 'The string is non-numeric' in cardno variable. Following is code of my formula:

StringVar cardno;
NumberVar current_len;
NumberVar card_len;
NumberVar start;
NumberVar last;
StringVar ca;

card_len := ToNumber (Mid ({@lens},1,2));
start := ToNumber (Mid ({@lens},3,2));
last := ToNumber (Mid ({@lens},5,2));

current_len := Length (Trim (ToText({CA.CA}, 0 ,'')));

ca := ReplicateString("0",card_len-current_len) + Totext({CA.CA},0,'');

If card_len > current_len Then
If start = 0 Then
If last <= 1 Then
cardno := Mid(ca, last, card_len)
Else
cardno := ReplicateString("X",last-start-1) + Mid(ca, last, card_len)
Else
cardno := Mid (ca,1,start) + ReplicateString("X",last-start-1) + Mid(ca, last, card_len);


Please provide a solution to avoid this error. Thanks in advance.

Continue reading...
 
Top