Accessing DataWindow object property values in code

Two techniques

There are two ways to access property values in a DataWindow object:

  • Methods

    The Describe and Modify methods use strings to specify the property names. For example:

    dw_1.Describe("empname.Border")
    dw_1.Modify("empname.Border=1")
  • Expressions

    DataWindow property expressions use the Object property and dot notation. For example:

    dw_1.Object.empname.Border = 1
    li_border = Integer(dw_1.Object.empname.Border)

In JavaScript, only the Describe and Modify methods are available.

Which technique to use

The technique you use depends on the type of error checking you want to provide and on whether you know the names of the controls and properties you want to access when the script is compiled.

If you want to

Use

Use column and property names that are known when the script is compiled

An expression

Avoid extra nested tildes (and you know the column and property names you want to access)

An expression

Build a string at runtime that names controls and properties

A method

Use the DWRuntimeError to handle problems with incorrect control or property names

An expression in a try-catch block

Use the Error event to handle problems with incorrect control or property names

An expression and a script for the Error event

Avoid using the Error event (or DWRuntimeError) for handling problems with incorrect control or property names

A method and code that evaluates its return value