Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Padding with zeroes
Message
From
18/09/1998 11:25:12
 
 
To
18/09/1998 10:16:36
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00137666
Message ID:
00138233
Views:
13
>>>>>You can try this in lostfocus
*lostfocus
>>>>>this.value = substr(this.value,1,1)+;
>>>>>        padl(val(substr(this.value,2)),5,"0")
Inputmask would be something like "A99999" and format "!".
>>>
>>>>Change lostfocus code to :
this.value = substr(this.value,1,1)+;
>>>>        padl(substr(trim(this.value),2),5,"0")
>>
>>TRANSFORM("@L 999999",XXX) pads XXX representation with zeroes; I would try to use that instead of PADL().

>Federico,
>You can use many routines for conversion. However here transform() doesn't seem to be a shorter (or faster - if ever a lostfocus like this one needs optimizing) coding to me. Maybe I could see why it's better if you provide full code.

I just prefer using TRANSFORM(); since FP gives us a way to pad numbers with zeroes automatically, I don't like (want) my programmers to reinvent the wheel or use (possibly) more obscure methods. My code would be
This.Value = LEFT(This.Value,1)+TRANSF("@L 99999", VAL(SUBSTR(THIS.VALUE,2))
I think I read somewhere that in FP there are at least three ways to do anything; I (let's emphasize that "I") just prefer the least involved way.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform