4D v13

WR GET REFERENCE

Home

 
4D Write v13
WR GET REFERENCE

WR GET REFERENCE 


 

WR GET REFERENCE ( area ; info1 ; info2 ; name ; type ; numFormat ; dateFormat ; timeFormat ) 
Parameter Type   Description
area  Longint in 4D Write area
info1  Integer in First information regarding the reference
info2  Integer in Second information regarding the reference
name  String in Receives reference name
type  Integer in Receives reference type
numFormat  String in Numeric format
dateFormat  Integer in Number of the date format
timeFormat  Integer in Number of the time format

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:

Constant Type Value Comment
System date short Longint 1 12/29/2006
System date abbreviated Longint 2 Sun, Dec 29, 2006
System date long Longint 3 Sunday, December 29, 2006
Internal date short special Longint 4 12/29/06 (but 12/29/1896 or 12/29/2096)
Internal date long Longint 5 December 29, 2006
Internal date abbreviated Longint 6 Dec 29, 2006
Internal date short Longint 7 12/29/2006

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:

Constant Type Value Comment
HH MM SS Longint 1 01:02:03
HH MM Longint 2 01:02
Hour Min Sec Longint 3 1  hour 2 minutes 3 seconds
Hour Min Longint 4 1 hour 2 minutes
HH MM AM PM Longint 5 1:02 AM

Refer to the example of the WR SELECT command.

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

 
PROPERTIES 

Product: 4D
Theme: WR Database Objects
Number: 89224

 
INDEX

Alphabetical list of commands

 
HISTORY 

Modified: 4D Write 6.7

 
SEE ALSO 

WR INSERT EXPRESSION
WR INSERT FIELD