WR GET REFERENCE
version 6.7 (Modified)
WR GET REFERENCE (area; info1; info2; name; type{; numFormat{; dateFormat{; timeFormat}}})
Parameter | Type | Description | |
area | Longint | 4D Write area | |
info1 | Integer | First information regarding the reference | |
info2 | Integer | Second information regarding the reference | |
name | String | Receives reference name | |
type | Integer | Receives reference type | |
numFormat | String | Numeric format | |
dateFormat | Integer | Number of the date format | |
timeFormat | Integer | Number of the time format |
Description
The WR GET REFERENCE command gets information about the selected reference in the 4D Write area.
Information about the selected reference is returned into the info1, info2, name and type parameters. You can also find out the display format of numeric, Date or Time inserted references.
Values returned in info1, info2, and name depend on the value in type. If the selected object is not a reference, type returns 0.
• If type=1, the reference is a field. info1 indicates the table number. info2 indicates the field number. name is empty.
• If type=2, the reference is an expression. info1 and info2 contain the value 0. name contains the name of the variable or expression.
The numFormat parameter returns a string indicating the format of the selected numeric field/expression (i.e., Real, Integer, or Longint). If no format is associated with the expression or if it is not a numeric type expression, an empty string is returned.
The dateFormat parameter returns the number of the Date format associated with the selected field/expression, if it is a date type. Should this not be the case, the value 0 is returned.
Otherwise, you can compare the value received to the following 4D constants, found in the "Date Display Formats" theme:
Date format | Constant (value) |
1/6/00 | System date short (1) |
Thu, Jan 6 2000 | System date abbreviated (2) |
Thursday, January 6 2000 | System date long (3) |
01/06/2000 | Internal date short special (4) |
January 6, 2000 | Internal date long (5) |
Jan 6, 2000 | Internal date abbreviated (6) |
01/06/2000 | Internal date short (7) |
The timeFormat parameter returns the number of the time format associated with the selected field/expression, if it is a time type. Should this not be the case, the value 0 is returned.
Otherwise, you can compare the value received to the following 4D constants, found in the "Time Display Formats" theme:
Time format | Constant (value) |
HH:MM:SS | HH MM SS (1) |
HH:MM | HH MM (2) |
HH hours MM minutes SS seconds | Hour Min Sec (3) |
HH hours MM minutes | Hour Min (4) |
HH:MM AM PM | HH MM AM PM (5) |
Example
This example determines if the user selected an object that is a reference. It also tells the user if the selected object is a field or an expression.
WR GET REFERENCE (Letter;$Table;$Field;$Name;$Type)
Case of
: ($Type=0) `Text or nothing
ALERT("Selected text or nothing")
: ($Type=1)
ALERT("Selected the field "+Field name($Table;$Field))
: ($Type=2)
ALERT("Selected the expression named "+$Name)
End case
See Also