Using DWSyntax

The DWSyntax tool, available on the Tool tab in the New dialog box, makes it easy to specify dot notation, Describe, Modify, and SyntaxFromSQL statements.

To access DWSyntax, select File>New and select the Tool tab. Select the type of statement you want to create from the Syntax menu:

  • Describe

    Select an object type from the Object dropdown listbox. In the Attributes listbox, select the property you want to describe. The bottom of the window displays Describe and dot notation statements.

  • Modify

    • Attributes

      Select an object type and the property you want to modify. The bottom of the window displays Modify and dot notation statements.

    • Create

      Select the object type that you want to create. The bottom of the window displays a Modify statement.

    • Destroy

      Select the object type that you want to destroy. The bottom of the window displays a Modify statement.

  • SyntaxFromSQL

    On each tab, select the properties you want to include in the arguments for the SyntaxFromSQL function. Notice that you can select multiple tabs and multiple properties per object for SyntaxFromSQL. When you have finished selecting properties, click Build Syntax to display the SyntaxFromSQL function at the bottom of the window.

  • Tips on the syntax generated by DWSyntax

Describe

Reports the values of properties of a DataWindow object and objects within the DataWindow object. Each column and graphic object in the DataWindow has a set of properties. You specify one or more properties as a string and Describe returns the values of the properties.

Modify

Modifies a DataWindow object by applying specifications, specified as a list of instructions, that change the DataWindow object's definition. You can change appearance, behavior, and database information for the DataWindow object by changing the values of properties. You can add and remove objects from the DataWindow object by providing specifications for the objects.

Create

Creates a DataWindow object using DataWindow source code and puts that object in the specified DataWindow control. This "dynamic" DataWindow object does not become a permanent part of the application source library.

Destroy

Deletes a DataWindow object. This dynamic DataWindow object change does not become a permanent part of the application source library.

SyntaxFromSQL

Generates DataWindow source code based on a SQL SELECT statement and Style. A full presentation string has the format:

"Style(Type= value property=value ...) DataWindow(property = value...) 
   Column(property = value...) 
   Group(groupby_col1 groupby_col2 ... property...) 
   Text(property = value...) 
   Title('titlestring')"

Tips on the syntax generated by DWSyntax

  • Anything surrounded by <> indicates that a real value must be substituted (without surrounding <>). All other syntax is correct as is including single quotes.

  • Internal to PowerBuilder, all DataWindow object properties are stored in strings. These can represent strings, numbers, or boolean (1/0, yes/no).

Where appropriate the compiler allows for the assigning of numbers or booleans and converts them to strings automatically. When these same property values are read they are returned as a string for the Describe syntax and as an Any variable for dot notation syntax.

Examples

The DataWindow readonly property is stored as 'yes' or 'no'.

Each of the following syntax statements sets the property to 'yes'.

dw_1.Modify("DataWindow.ReadOnly=Yes")
dw_1.Modify("DataWindow.ReadOnly=True")
dw_1.Object.DataWindow.ReadOnly = 'Yes'
dw_1.Object.DataWindow.ReadOnly = True

The result of dw_1.Describe("DataWindow.ReadOnly") is a string containing either 'yes' or 'no'.

The result of dw_1.Object.DataWindow.ReadOnly is an Any containing either 'yes' or 'no'.

The Column.Border property is stored as '0' through '6'.

Each of the following syntax statements sets the property to '5'.

dw_1.Modify("Column.Border = 5 ")
dw_1.Modify("Column.Border = '5' ")
dw_1.Object.Column.Border =  5
dw_1.Object.Column.Border = '5'

The result of dw_1.Describe("Column.Border") is always a string.

The result of dw_1.Object.Column.Border is an Any always containing a string.