在水晶报表中屏蔽字段后,我已经放置了一个公式来显示字段的值。但它在cardno变量中显示了一个错误“字符串是非数字的” 。以下是我的公式的代码:
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);
请提供解决方案以避免此错误。提前致谢。