Command WR GET REFERENCE

4D Write

WR GET REFERENCE

version 6.7 (Modified)


WR GET REFERENCE (area; info1; info2; name; type{; numFormat{; dateFormat{; timeFormat}}})

ParameterTypeDescription
areaLongint4D Write area
info1IntegerFirst information regarding the reference
info2IntegerSecond information regarding the reference
nameStringReceives reference name
typeIntegerReceives reference type
numFormatStringNumeric format
dateFormatIntegerNumber of the date format
timeFormatIntegerNumber 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 formatConstant (value)
1/6/00System date short (1)
Thu, Jan 6 2000System date abbreviated (2)
Thursday, January 6 2000System date long (3)
01/06/2000Internal date short special (4)
January 6, 2000Internal date long (5)
Jan 6, 2000Internal date abbreviated (6)
01/06/2000Internal 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 formatConstant (value)
HH:MM:SSHH MM SS (1)
HH:MMHH MM (2)
HH hours MM minutes SS secondsHour Min Sec (3)
HH hours MM minutesHour Min (4)
HH:MM AM PMHH 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

WR INSERT EXPRESSION, WR INSERT FIELD.