Schultz’s PowerBuilder Notes

Dot Notation (Direct Access)


Dot notation for updating DataWindow properties first appeared in PowerBuilder 5. Before this time, programmers could only use Modify( ) and Describe to update DataWindow properties.

How do I set data?

dw_1.object.shft_sched_id[1]= ll_shift_sched_id

How do I set a column for all the rows to the same value?

If I want to set all row’s STRM_ID column to the value 1234.  lsa_default is array with the same size as the number of rows.  Eche array element has a value of 1234.

dw_1.Object.strm_id.Primary = lsa_default

How do I update the static text in the header of a datawindow?

dw_report.Object.t_comail.Text = ls_comail_id

How do I get data?

Li_seq = dw_1.object.seq_no[li_row]

The Object property of the DataWindow control lets you specify expressions that refer directly to the data of the DataWindow object in the control. This direct data manipulation allows you to access small and large amounts of data in a single statement, without calling methods.

There are several variations of data expression syntax, divided into three groups. This section summarizes these syntaxes. The syntaxes are described in detail later in this chapter.

Data in columns or computed fields when you know the name

One or all items (if rownum is absent, include either buffer or datasource)

dwcontrol.Object.columnname {.buffer } {.datasource } { [ rownum ] }

Returns a single value (for a specific row number) or an array of values (when rownum is omitted) from the column.

Selected items

dwcontrol.Object.columnname {.Primary }{.datasource }.Selected

Returns an array of values from the column with an array element for each selected row.

Populating an array with a column’s values for all rows

From a script written by Dan M.

 

string lsa_mult_cycl_nbr[]
lsa_mult_cycl_nbr = ids_get_mult_cycl_nbr.Object.mult_cycl_nbr.Primary
ids_get_multi_mail_pstl_cl_tp.Retrieve(lsa_mult_cycl_nbr)

 

Range of items

dwcontrol.Object.columnname {.buffer } {.datasource } [ startrownum, endrownum ]

Returns an array of values from the column with an array element for each row in the range.

Data in numbered columns

Single items

dwcontrol.Object.Data {.buffer } {.datasource } [ rownum, colnum ]

Returns a single item whose data type is the data type of the column.

Blocks of data involving a range of rows and columns

dwcontrol.Object.Data {.buffer } {.datasource } [ startrownum, startcolnum, endrownum, endcolnum ]

Returns an array of structures or user objects. The structure elements match the columns in the range. There is one array element for each row in the range.

Whole rows

Single row or all rows

dwcontrol.Object.Data {.buffer } {.datasource } { [ rownum ] }

Returns one structure or user object (for a single row) or an array of them (for all rows). The structure elements match the columns in the DataWindow object.

Selected rows

dwcontrol.Object.Data {.Primary } {.datasource } .Selected

Returns an array of structures or user objects. The structure elements match the columns in the DataWindow object. There is one array element for each selected row.

How do I make a DataWindow Read Only?

To use a DataWindow for reporting purposes only, set its ReadOnly attribute so users can not place focus on its columns.

Dw_1.Object.DataWindow.ReadOnly=’yes’

About these ads

May 25, 2008 - Posted by | Datawindow PowerScript | , , , , , , , , , ,

3 Comments »

  1. Its a good site for knowing powerbuilder.

    Comment by Syed Kazim Husain | July 22, 2008 | Reply

  2. Can fields in the header/footer be obtained using dot notation?

    Thanks

    Comment by Marvin Haagsma | April 20, 2009 | Reply

    • From DW Syntax:

      .Object.DataWindow.Footer.Text
      .Object.DataWindow.Header.Text

      I think the following will work too (MyField is a text item on the header or footer)

      ls_my_field = dw_1.Describe(“MyField.text”)

      Comment by rick130 | April 21, 2009 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: