Fnd_Data
10 shared methods.
- Fnd_Data_EmailAddressError
- Fnd_Data_FormatBypass
- Fnd_Data_FormatBypassKey
- Fnd_Data_FormatError
- Fnd_Data_FormatPhone
- Fnd_Data_FormatPostalCode
- Fnd_Data_FormatText
- Fnd_Data_FormatWebURL
- Fnd_Data_Info
- Fnd_Data_ParseName
Fnd_Data_EmailAddressError
Fnd_Data_EmailAddressError (email address{; ->description}) --> Longint
Checks Email address and returns an error number if the email address doesn't have a valid format.
Pass a pointer to a text variable as the second parameter to receive a description of the problem. It is empty when the address is valid.
$error_i:=Fnd_Data_EmailAddressError("john smith@here.com"; ->$why_t)
1, and $why_t is "There is a space in the address."
| Parameter | Type | Direction | Description |
|---|---|---|---|
inEmailAddress | Text | in | The email address to check |
inDescription | Pointer | in | Gets a description of the problem (optional) |
Result | Longint | out | Error number (0=valid format, 1=invalid format) Based on code posted to the 4D NUG by Owen Watson<owen.watson@paradise.net.nz>. |
Fnd_Data_FormatBypass
Fnd_Data_FormatBypass --> Boolean
Returns True if the data entry formatting routine should be bypassed. Usually this will be because the user is holding down the bypass key, but there may be other reasons.
Sets Fnd.Data.formatError to -1 if True is returned.
| Parameter | Type | Direction | Description |
|---|---|---|---|
Result | Boolean | out | True if the routine should be bypassed |
Fnd_Data_FormatBypassKey
Fnd_Data_FormatBypassKey ({key}) --> Longint
Pass a key mask to set a new bypass key.
Pass 0 to disable the bypass option.
Pass 1 to always bypass the format routines (turn off formatting).
Returns the currently set bypass key.
Bypass key can be any of these 4D constants: Option key mask (default) Command key mask Control key mask Shift key mask Caps lock key mask
The setting is shared, so it applies to every process in the host.
| Parameter | Type | Direction | Description |
|---|---|---|---|
inKey | Longint | in | The new bypass key mask (optional) |
Result | Longint | out | The current bypass key mask |
Fnd_Data_FormatError
Fnd_Data_FormatError --> Longint
Allows the developer to detect if any of the data formatting routines had a problem trying to format data.
0 The last call formatted the value
1 The last call could not work out how to format the value
-1 The last call was bypassed because the bypass key was down
The value is per process, and each formatting method resets it before it starts, so read it immediately after the call it belongs to.
| Parameter | Type | Direction | Description |
|---|---|---|---|
Result | Longint | out | Last formatting error |
Fnd_Data_FormatPhone
Fnd_Data_FormatPhone (phone number{; style | options}) --> Text
Formats a phone number. With no second parameter the number is formatted the US way, 000-000-0000 or 000-0000.
The number is not formatted if the user holds down the Option/Alt key (or other key that's been specified by the developer).
If it can't work out how to format the number it returns it unchanged and sets Fnd.Data.formatError to 1, which Fnd_Data_FormatError reports.
The second parameter has two forms:
1. A Longint. Accepted and ignored, giving US formatting. 2. An object, which is how a country or an explicit format is chosen.
Fnd_Data_FormatPhone("0412345678"; {country: "AU"}) --> (0412) 345 678
Fnd_Data_FormatPhone("0298765432"; {country: "AU"}) --> (02) 9876 5432
Fnd_Data_FormatPhone("5551234"; {format: "000.0000"}) --> 555.1234
Object properties, with the default applied when the property is absent:
country Text "US" or "AU". Defaults to "US"
format Text An explicit 4D number format, which overrides country
areaCode Text Prefixed to an 8 digit Australian number. Defaults to none
An Australian number of 9 digits is taken to have lost its leading zero, and the zero is put back.
| Parameter | Type | Direction | Description |
|---|---|---|---|
inPhoneNumber | Text | in | The phone number to format |
inStyle | Variant | in | A legacy style Longint, or an options object (optional) |
Result | Text | out | The formatted phone number |
Fnd_Data_FormatPostalCode
Fnd_Data_FormatPostalCode (postal code{; style | options}) --> Text
Formats a text value into a postal code. If it can't work out how to format it then it returns the postal code unchanged and sets Fnd.Data.formatError to 1, which Fnd_Data_FormatError reports.
Anything that is not a letter or a digit is removed first.
With no second parameter the country is deduced from the value: five or nine digits is a US ZIP code, and a six character letter-digit-letter-digit-letter-digit value is Canadian.
The second parameter has two forms:
1. A Longint. Accepted and ignored. 2. An object naming the country, which skips the deduction.
Fnd_Data_FormatPostalCode("k1a0b1"; {country: "CA"}) --> K1A 0B1
Fnd_Data_FormatPostalCode("3000"; {country: "AU"}) --> 3000
Object properties, with the default applied when the property is absent:
country Text "US", "CA" or "AU". Defaults to deducing it from the value
| Parameter | Type | Direction | Description |
|---|---|---|---|
inPostalCode | Text | in | The postal code to format |
inStyle | Variant | in | A legacy style Longint, or an options object (optional) |
Result | Text | out | The formatted postal code |
Fnd_Data_FormatText
Fnd_Data_FormatText (text{; options}) --> Text
Strips any extra spaces before and after the text, removes double spaces within the text, then capitalizes the first letter of each word, unless the user holds down the Option/Alt key (or other bypass key that's been specified by the developer).
The optional second parameter is an object, for the cases where title case is the wrong answer — a surname entered in capitals, a product code, an email address that must stay lowercase.
Fnd_Data_FormatText(" john smith ") --> John Smith
Fnd_Data_FormatText("MacDonald"; {case: "none"}) --> MacDonald
Fnd_Data_FormatText("Me@Here.COM"; {case: "lower"}) --> me@here.com
Object properties, with the default applied when the property is absent:
case Text "title", "upper", "lower" or "none". Defaults to "title"
stripSpaces Boolean Whether to strip the spaces first. Defaults to True
| Parameter | Type | Direction | Description |
|---|---|---|---|
inTheText | Text | in | The text to capitalize |
inOptions | Variant | in | An options object (optional) |
Result | Text | out | The capitalized text |
Fnd_Data_FormatWebURL
Fnd_Data_FormatWebURL (url{; options}) --> Text
Formats the URL. A URL with no scheme gets https.
The URL is not formatted if the user holds down the Option/Alt key (or other key that's been specified by the developer).
Fnd_Data_FormatWebURL("example.com") --> https://example.com/
Fnd_Data_FormatWebURL("example.com"; {scheme: "http"}) --> http://example.com/
Object properties, with the default applied when the property is absent:
scheme Text The scheme for a URL that has none. Defaults to "https"
| Parameter | Type | Direction | Description |
|---|---|---|---|
inURL | Text | in | The URL to format. |
inOptions | Variant | in | An options object (optional) |
Result | Text | out | The formatted URL. |
Fnd_Data_Info
Fnd_Data_Info (label) --> Text
Returns requested information. See the Fnd_Gen_ComponentInfo method for more information.
| Parameter | Type | Direction | Description |
|---|---|---|---|
request | Text | in | Info desired ("version" or "name") |
Result | Text | out | Response |
Fnd_Data_ParseName
Fnd_Data_ParseName (name{; ->first name{; ->last name{; ->middle initial}}}) --> Object
Attempts to split a person's full name into separate parts.
Drops titles such as Mr. Mrs. Jr., Sr., M.D., etc.
The parts are returned as an object, and also written through any pointers that are passed. Every pointer is optional.
$name_o:=Fnd_Data_ParseName("Dr. John Q. Smith")
{first: "John"; last: "Smith"; middleInitial: "Q"}
Fnd_Data_ParseName("Dr. John Q. Smith"; ->$first_t; ->$last_t; ->$initial_t)
| Parameter | Type | Direction | Description |
|---|---|---|---|
inFullName | Text | in | The name to parse |
firstName | Pointer | in | Gets the first name (optional) |
lastName | Pointer | in | Gets the last name (optional) |
middleInitial | Pointer | in | Gets the middle initial (optional) |
Result | Object | out | The parts, as first, last and middleInitial |