Advantage and drawbacks of the Modify and Describe methods in JavaScript – PB Docs 126

Advantage and drawbacks of the Modify and Describe methods in JavaScript

In JavaScript, using the Describe and Modify methods
to access DataWindow property values has advantages and drawbacks.
The examples here use Modify as illustrations, but similar considerations
apply to Describe.


You can specify column and property names dynamically

In your script, you can build a string that specifies the
column and property names.

For example, the following code builds a string in which the
default color value and the two color values in the If function
are determined in the script. Notice how the single quotes around
the expression are included in the first and last pieces of the

The resulting string when red_amount is set to 128

The following is a simpler example without the If function.
The Color property for the column specified in ls_columnname
is set to a constant value. You do not need quotes around the value
if you are not specifying an expression:


Setting several properties at once is possible
but hard to debug

Although you can set several properties in a single method
call, it is harder to understand and debug scripts that do so.

For example, the code for setting three properties is not
too complex because there are no nested strings:

Complex quoted strings are sometimes required

When you specify an expression for a property value, it is
difficult to specify nested quotes correctly—the code is
hard to understand and prone to error. For Describe,
this is less of a drawback—strings will not become as complex
because they do not include an expression.

For example, this string entered on a single line in a script
assigns a DataWindow expression to the Color property:

For more information about quoted strings,
see the PowerScript Reference.

Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x