Retrieving data – PB Docs 2017

Retrieving data

Where PowerBuilder gets
data

PowerBuilder follows this order of precedence to supply the data
in your DataWindow object:

  • If you have saved data in the DataWindow object,
    PowerBuilder uses the saved rows from the DataWindow object and
    does not retrieve data from the database.

  • PowerBuilder uses the data in the cache, if there is
    any.

  • If there is no data in the cache yet, PowerBuilder retrieves
    data from the database automatically, with one exception. If the
    Retrieve on Preview option is off, you have to request retrieval
    explicitly, as described next.

Previewing without retrieving
data

If you do not want PowerBuilder to retrieve data from the
database automatically when the Preview view opens, you can clear the
Retrieve on Preview option. The Preview view shows the DataWindow
object without retrieving data.

To be able to preview without retrieving data
automatically

  1. Select Design>Options from the menu bar.

    The DataWindow Options dialog box displays.

  2. Clear the Retrieve on Preview check box on the General
    page.

    When this check box is cleared, your request to preview the
    DataWindow object does not result in automatic data retrieval from
    the database.

Retrieve on Preview check box is available in the DataWindow
wizards

During the initial creation of a DataWindow object, you can
set the Retrieve on Preview option.

PowerBuilder uses data
caching

When PowerBuilder first retrieves data, it stores the data
internally. When it refreshes the Preview view, PowerBuilder displays
the stored data instead of retrieving rows from the database again.
This can save you a lot of time, since data retrieval can be time
consuming.

How using data from the cache affects
you

Because PowerBuilder accesses the cache and does not
automatically retrieve data every time you preview, you might not have
what you want when you preview. The data you see in preview and the
data in the database can be out of sync.

For example, if you are working with live data that changes
frequently or with statistics based on changing data and you spend
time designing the DataWindow object, the data you are looking at may
no longer match the database. In this case, retrieve again just before
printing.

Explicitly retrieving
data

You can explicitly request retrieval at any time.

To retrieve rows from the database

  • Do one of the following:

    • Click the Retrieve button in the PainterBar.

    • Select Rows>Retrieve from the menu bar.

    • Select Retrieve from the Preview view’s pop-up
      menu.

Supplying argument values or criteria

If the DataWindow object has retrieval arguments or is set up
to prompt for criteria, you are prompted to supply values for the
arguments or to specify criteria.

PowerBuilder retrieves the rows. As PowerBuilder retrieves, the
Retrieve button changes to a Cancel button. You can click the Cancel
button to stop the retrieval at any time.

Sharing data with the Data
view

The Data view displays data that can be used to populate a
DataWindow object. When the ShareData pop-up menu item in the Data
view is checked, changes you make in the Data view are reflected in
the Preview view and vice versa.

Other options that affect
retrieval

These other options can affect retrieval:

  • Retrieve Rows As
    Needed

    Lets you specify that only the rows needed to display the
    current portion of the DataWindow object should be retrieved. When
    you scroll downward, additional rows are retrieved. This can speed
    up reporting in certain situations.

    See Retrieving rows as
    needed
    .

  • Retrieve Rows to
    Disk

    Lets you specify that PowerBuilder should save retrieved
    data on your hard disk in a temporary file rather than keep the
    data in memory. When you preview the DataWindow object,
    PowerBuilder swaps rows of data from the temporary file into
    memory as needed.

    For information, see Saving
    retrieved rows to disk
    .


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x