Left Pad Zero Fill

If you have any specific fields that are lengthy and are left padded with zeroes, you can save your users a lot of time by alowing them to type ONLY the right most numbers.

 

For example, lets say you have a field INV_ITEM_ID and the length is 18 and left padded with zeroes. The number is 000000000000123456. Your user can just enter 123456 and when they tab out of that field, you left pad all the zero's.

This can be done easily by using the following code.


If INV_ITEM_ID <> “Next” Then
&ITMIDLEN = Len(INV_ITEM_ID);
&FILLLEN = 18 - &ITMIDLEN;
If &ITMIDLEN < 18 And
&ITMIDLEN > 0 Then
&CHECKFIRST = Substring(INV_ITEM_ID,1,1);
If &CHECKFIRST <> “%”;
INV_ITEM_ID = Rept(“0”, &FILLLEN) / INV_ITEM_ID;
End-If;
End-If;
End-If;

You can use this code on any field that is left paded.

转载于:https://www.cnblogs.com/GoDevil/archive/2009/01/09/1372618.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值