SyntaxFromSQL – PB Docs 126

SyntaxFromSQL PowerScript function

Description

Generates DataWindow source code based on a SQL SELECT statement.

Controls

Transaction objects

Syntax

Argument

Description

transaction

The name of a connected transaction object.

sqlselect

A string whose value is a valid SQL SELECT statement.

presentation

A string whose value is the default presentation
style you want for the DataWindow. The simple format is:

Values for presentationstyle correspond
to selected styles in the New DataWindow dialog box in the DataWindow
painter. Keywords are:

  • (Default) Tabular

  • Grid

  • Form (for freeform)

  • Graph

  • Group

  • Label

The Usage section lists the keywords you can use in presentation.

err

A string variable to which PowerBuilder
will assign any error messages that occur.

Return Values

String. Returns the empty string (“”)
if an error occurs. If SyntaxFromSQL fails, err may
contain error messages if warnings or soft errors occur (for example, a
syntax error). If any argument’s value is null, SyntaxFromSQL returns null.

Usage

To create a DataWindow object, you can pass the source code
returned by SyntaxFromSQL directly to the Create function.

Table owner in the SQL statement

If the value of the LogID property of the Transaction object
is not the owner of the table being accessed in the SQL statement for the SyntaxFromSQL function,
then the table name in the SQL SELECT statement
must be qualified with the owner name.

note.png Note for 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 only possible if you set AutoCommit to true before calling SyntaxFromSQL,
as shown here:

The presentation string can also specify
object keywords followed by properties and values to customize the
DataWindow. You can specify the style of a column, the entire DataWindow,
areas of the DataWindow, and text in the DataWindow. The object
keywords are:

  • Column

  • DataWindow

  • Group

  • Style

  • Text

  • Title

A full presentation string has the format:

The checklists in the DataWindow object properties chapter
in the DataWindow Reference identify the properties
that you can use for each object keyword.

If a database column has extended attributes with font information,
then font information you specify in the SyntaxFromSQL presentation
string is ignored.

Examples

The following statements display the DataWindow source
for a tabular DataWindow object generated by the SyntaxFromSQL function
in a MultiLineEdit.

If errors occur, PowerBuilder fills the string ERRORS with
any error messages that are generated:

The following statements create a grid DataWindow dw_1 from
the DataWindow source generated in the SyntaxFromSQL function.
If errors occur, the string ERRORS contains
any error messages that are generated, which are displayed to the
user in a message box. Note that you need to call SetTransObject with SQLCA as its argument before
you can call the Retrieve function:

See Also

  • Create method
    for DataWindows in the DataWindow Reference or online Help

  • Information on DataWindow object properties in 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