Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Creating a DataWindow object – PB Docs 105 – PowerBuilder Library

Creating a DataWindow object – PB Docs 105

Creating a DataWindow object

This section describes how to create a DataWindow object by
calling the Create method in an application.

note.gif DataWindow painter You should use the techniques described here for creating
a DataWindow from syntax only if you cannot accomplish what you
need to in the DataWindow painter. The usual way of creating DataWindow
objects is to use the DataWindow painter.

To learn about creating DataWindow objects
in the DataWindow painter, see the PowerBuilder User’s
Guide

.

You use the Create method to create a DataWindow object dynamically
during execution. Create generates a DataWindow object using source
code that you specify. It replaces the DataWindow object currently
in the specified DataWindow control with the new DataWindow object.

note.gif Resetting the transaction object The Create method destroys the association between the DataWindow
control and the transaction object. As a result, you need to reset
the control’s transaction object by calling the SetTransObject
or SetTrans method after you call Create.

Web ActiveX If you used a connection technique that did not require you
to call the SetTransObject or SetTrans method, you do not need to
call it after Create either.

To learn how to associate a DataWindow control
with a transaction object, see Chapter 2, “Using DataWindow Objects.”

Specifying the DataWindow
object syntax

There are several ways to specify or generate the syntax required
for the Create method. Not all the techniques are available in all
environments.

In PowerBuilder, you can:

  • Use
    the SyntaxFromSQL method of the transaction object
  • Use the LibraryExport PowerScript function

In all environments, you can:

  • Use the
    DataWindow.Syntax property of the DataWindow object
  • Create the syntax yourself

Using SyntaxFromSQL You are likely to use SyntaxFromSQL to create the syntax for
most dynamic DataWindow objects. If you use SyntaxFromSQL, all you
have to do is provide the SELECT statement and the presentation
style.

In PowerBuilder, SyntaxFromSQL is a method of the transaction
object. The transaction object must be connected when you call the
method.

note.gif Setting USERID for native drivers In PowerBuilder, table names are automatically qualified with
the owner’s name if you are using a native driver. To obtain
the same results in an application, you must set the USERID property
in the transaction object so that the table name is properly qualified
and extended attributes can be looked up.

SyntaxFromSQL has three required arguments:

  • A string containing the SELECT statement for the DataWindow
    object
  • A string identifying the presentation style and
    other settings
  • The name of a string you want to fill with any error
    messages that might result

SyntaxFromSQL returns the complete syntax for a DataWindow
object that is built using the specified SELECT statement.

note.gif Using SyntaxFromSQL with Adaptive Server Enterprise If your DBMS is Adaptive Server Enterprise and you call SyntaxFromSQL, PowerBuilder
must determine whether the tables are updatable through a unique
index. This is possible only if you set AutoCommit to TRUE before calling
SyntaxFromSQL, as shown below:

Using LibraryExport in PowerBuilder You can use the LibraryExport PowerScript function to export
the syntax for a DataWindow object and store the syntax in a string.

You can then use the exported syntax (or a modification of
the syntax) in Create to create a DataWindow object.

Using the DataWindow.Syntax property You can obtain the source code of an existing DataWindow object
to use as a model or for making minor changes to the syntax. Many
values in the source code syntax correspond to properties of the
DataWindow object.

This JavaScript example gets the syntax of the DataWindow
object in the DataWindow control, dw_1, and displays it
in the text box control, textb_dw_syntax :

Creating the syntax yourself You need to create the syntax yourself to use some of the
advanced dynamic DataWindow features, such as creating a group break.

The DataWindow source code syntax that you need to supply
to the Create method can be very complex. To see examples of DataWindow
object syntax, go to the Library painter and export a DataWindow
object to a text file, then view the file in a text editor.

For more information on Create and Describe
methods as well as DataWindow object properties and syntax, see
the DataWindow Reference
.


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