Skip to main content
Version: 20 R7 BETA

RESOLVE POINTER

RESOLVE POINTER ( aPointer ; varName ; tableNum ; fieldNum )

ParameterTypeDescription
aPointerPointerPointer for which to retrieve the referenced object
varNameTextName of referenced variable or empty string
tableNumIntegerNumber of referenced table or array element or 0 or -1
fieldNumIntegerNumber of referenced field or 0

Description

The RESOLVE POINTER command retrieves the information of the object referenced by the pointer expression aPointer and returns it into the parameters varName, tableNum, and fieldNum.

Depending on the nature of the referenced object, RESOLVE POINTER returns the following values:

Referenced objectParameters
varNametableNumfieldNum
None (NIL pointer)"" (empty string)00
VariableName of the variable-1-1
ArrayName of the array-1-1
Array elementName of the arrayElement number-1
2D array elementName of the 2D arrayElement row numberElement column number
Table"" (empty string)Table number0
Field"" (empty string)Table numberField number

Notes:

  • If the value you pass in pointer is not a pointer expression, a syntax error occurs.
  • The RESOLVE POINTER command does not work with pointers to local variables. In fact, by definition several local variables with the same name could exist in different locations, so it is not possible for the command to find the correct variable.

Example 1

Within a form, you create a group of 100 enterable variables called v1, v2... v100. To do so, you perform the following steps:

a. Create one enterable variable that you name v.

b. Set the properties of the object.

c. Attach the following method to that object:

 DoSomething(Self) // DoSomething being a project method in your database

d. At this point, you can either duplicate the variable as many times as you need, or use the Objects on Grid feature in the Form Editor.

e. Within the DoSomething method, if you need to know the index of the variable for which the method is called, you write:

 RESOLVE POINTER($1;$vsVarName;$vlTableNum;$vlFieldNum)
 $vlVarNum:=Num(Substring($vsVarName;2))

Note that by constructing your form in this way, you write the methods for the 100 variables only once; you do not need to write DoSomething (1), DoSomething (2)...,DoSomething (100).

Example 2

For debugging purposes, you need to verify that the second parameter ($2) to a method is a pointer to a table. At the beginning of this method, you write: // ...

 If(<>DebugOn)
    RESOLVE POINTER($2;$vsVarName;$vlTableNum;$vlFieldNum)
    If(Not(($vlTableNum>0)&($vlFieldNum=-1)&($vsVarName="")))
  // WARNING: The pointer is not a reference to a table
       TRACE
       End
    End if
  // ...

Example 3

See example for the _o_DRAG AND DROP PROPERTIES command.

Example 4

Here is an example of a 2D array pointer:

 ARRAY TEXT(atCities;100;50)
 var $city : Pointer
 atCities{1}{2}:="Rome"
 atCities{1}{5}:="Paris"
 atCities{2}{6}:="New York"
  // ...other values
 $city:=->atCities{1}{5}
 RESOLVE POINTER($city;$var;$rowNum;$colNum)
  //$var="atCities"
  //$rowNum="1"
  //$colNum="5"

See also

_o_DRAG AND DROP PROPERTIES
Field
Get pointer
Is a variable
Is nil pointer
Table