您的位置:首页 > 其它

Left Pad Zero Fill

2009-01-09 14:06 302 查看
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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: