The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Is there any documentation or examples of FormatString property by FormatType and or data type?
Posted: 10 Aug 07 8:14 AM
|
This does not seem to follow the VBScript examples I have. I am specifically having a problem with the FormatString for the FormatType ftInteger. Some users are trying to put in alpha characters in the field. When this is done the field displays the character when in the field and 0 when not in the field. When they leave the tab they get a data type error and it erases all of the other data the entered on the tab.
In contrast, I found a successful FormatString for the FormatType of ftPercent as %.3f%%. This behaves as expected. Even if a user enters text into the field, it is ignored and displays and stores 0.000% and this does not cause the error or the loss of data as in my integer example. Any help is greatly appreciated.
|
|
|
| |
|
Re: Is there any documentation or examples of FormatString property by FormatType and or data type?
Posted: 10 Aug 07 1:03 PM
|
Jeff thanks for the info. I also found some scripts in System:SLX_Common to check for valid numers. These will work for now, and I plan to use them to fix this today, but there should be a simple FormatString that will only allow numbers like the one for percents. Please le me know if you come up with any other ideas.
Function SLXIsNumeric(Value) SLXIsNumeric = IsNumeric(Value) or (vartype(value) = vbdecimal) End Function
'and
Function ValidateIntegerEntry(Key) If ((Key < 48) Or (Key > 57)) And Not (Key = 8) And Not (Key = 46) And Not (Key = 44) Then ValidateIntegerEntry = 0 Else ValidateIntegerEntry = Key End If End Function |
|
|
| |
|
Re: Is there any documentation or examples of FormatString property by FormatType and or data type?
Posted: 10 Aug 07 3:55 PM
|
I found this in the help file. I tried %d0 and %x0 but niether prevented alpha charcters like the %.3f%% does for the FormatType ftPercent. Do you have any examples for of FormatStrings for the ftInteger FormatType? The option "d" below does make sence to me since integers do not support decimals. I also do not understand the hexadecimal option x.
The table below lists the format string options for integer fields. Valid string formats depend on the format type you select.
A format string must begin with a % sign and end with a format type character:
[%] [type] Option Description d Decimal. The value must be an integer. The value is displayed as a decimal. x Hexadecimal. The format of the field must be an integer value. The value is converted to a string of hexadecimal digits. If the format string contains a precision specifier, it indicates the resulting string must contain at least the specified number of digits; if the value has fewer digits, the resulting string is left-padded with zeros.
|
|
|
|