2017-01-05 7 views
-1

형식 문제와 함께 값을 전달하는 것과 관련된 문제가 있습니다. 설명은 내가 코드 에 대한 내 코드에서 내 PreEditedCheque을 전달하는 데 코드를 넣었습니다. if length(RawChequenumber) = 15의 출력은 1 자리 대신 00001 (예) 당신이 요구하는지 무엇숫자 형식의 값 전달

MM = HostGetFLD('','MM') 
YY = HostGetFLD('','YY') 
PreEditedCheque = substr(RawChequenumber,11,5) 

ValidateMMonCheque = substr(RawChequenumber,7,2) 

if ValidateMMonCheque <> MM Then *From this statement* 
Do 
    PreEditedCheque = substr('00000',1,5) *This part where those 0 can't be properly shown if pass to the next statement* 
    EditedCheque = '00'||'2'||'0'||YY||MM||'00'||PreEditedCheque 
    rc = message(2,2,EditedCheque) 
End 


if length(RawChequenumber) = 15 Then 

    EditedCheque = '00'||'2'||'0'||YY||MM||'00'||PreEditedCheque + 1 *Second statement if <>MM ran, this part, the PreEditedCheque will be not in 00001, it will be 1. 

rc = PanSetCtlData('PREVIEW',EditedCheque) 
+0

입력 내용은 무엇이며 어떤 결과가 나고 무엇을 기대하고 있습니까 ??? –

+0

출력이 00001 (5 자리) 대신 1 (한 자리 만)이 될 것으로 예상됩니다. 실제로 입력은 rawchequenumber 변수에서 전달됩니다. –

+0

문제는 두 번째 명령문에서'+'입니다.이 표현식은 숫자 표현식으로 변환됩니다. Right 함수를 사용하는 로스의 제안은 작동합니다. –

답변

3

수표 번호가 5 문자 필드에 제로 왼쪽에 채워 가지고있다가됩니다.는 /는 귀하의 친구입니다 :

Right(PreEditedCheque, 5, '0') /* "1" -> "00001" */ 
+0

고마워요, 로스. 그것은 작동합니다. –