Page tree
Skip to end of metadata
Go to start of metadata

Accessing current object values

Accessing the current value of a D2000 system object is allowed by the function D2_GetValue.

D2_GetValue(objName, attribute, refresh) 


TEXT type

Object name.

TEXT type

Required object value attribute.
refresh   Optional parameter.

The function returns required attribute of the value of given object. Object name is defined by the parameter ObjName. For objects of value array, it is possible to use the declaration: array[3] – indexing, or for structured variables: struct[2]^ItemName – access to item. Value attribute is given by the parameter Attribute. It is a text string with the length of 3 characters, which are equal with names of object value attributes.

The optional parameter Refresh is used to force the of the function computation. The parameter has been implemented for the reason of the MS Excel method to calculate expressions in a cell.
Expressions will be calculated if:

  • the cell contents is manually modified (editing the expression),
  • function parameters is modified - reference to a modified cell.

The parameter Refresh allows to initialize calculating the expression.

Expression in cell:
= D2_GetValue("Sec", "")

The expression gets the value of the object Sec right in the moment of computation. Reloading the current value can be performed only by manual editing of the expression.

Expression in cell:
= D2_GetValue("Sec", "TIM")

The function works analogous to the previous example, but its return value is the time of the object value (in D2000 system, there is an equivalent declaration Sec\TIM).

Both the expressions give one trouble: the cells containing such expressions will not be updated after opening the workbook. Their contents stay unchanged since last the cells was editing last time (and saving the workbook). Using the parameter Refresh eliminates the problem.

Expressions in cell:
= D2_GetValue("Sec", "", A3)

The function works analogous to the previous example. Using the optional parameter will provides for computation of the expression if the value of the cell A3 is changed.

If the following expression is typed into the cell A3:
= NOW()

the expression D2_GetValue(“Sec”, “”, A3) will be computed also when the workbook is opening.

For the parameter Refresh, it is appropriate to use the reference to the cell D2000_BT (the cell is automatically computed when the workbook is opening  – see the topic Predefined cells).

Write a comment…