-1

我有关于通过格式问题传递值的问题。我在代码中输入的描述,因为我在传递我PreEditedCheque的代码时遇到问题if ValidateMMonCheque <> MM。的输出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)
4

1 回答 1

3

您要求的是在 5 个字符的字段中用零填充左侧的支票号码。Right() 函数是你的朋友:

Right(PreEditedCheque, 5, '0') /* "1" -> "00001" */
于 2017-01-05T16:38:58.347 回答