Sybase Business Intelligence Solutions - Database Management, Data Warehousing Software, Mobile Enterprise Applications and Messaging
Sybase Brand Color Bar
delete

Search for    in all of Sybase.com
view all search results right arrow
  blank
 
 
 
 
 
Support > Technical Documents > Document Types > Technote > Evaluating Datawindow Attribute Expressions at Run...

Evaluating Datawindow Attribute Expressions at Runtime using Describe

This document contains information on how to use the Attribute Conditional Expression dialog in the datawindow painter to evaluate the column attributes.
 
RSS Feed
 
 
 


Evaluating Datawindow Attribute Expressions at Runtime using Describe (PB 5.x and later).

Powerbuilder contains the functionality to set column attributes such as Protect through the use of the new Attribute Conditional Expression dialog in the datawindow painter.

PowerBuilder automatically evaluates these expressions at runtime. An example of a attribute expression for the Protect attribute of a column:

    if (isRowNew(), 0,1)

When you query an attribute value at runtime using the Describe function such as:

    dw_1.Describe(emp_id.protect)

Describe returns the expression, not the value. In version 5.0 and up, you can also use dot notation to obtain the value of the expression:

dw_1.object.emp_id.protect // must convert to string before manipulation using String()

The expression will be in the form:

<default_value><tab><expression>

From the Protect attribute example above:

   0 <tab> if (isRowNew(), 0,1)

You need a second Describe - using Evaluate and the expression returned from the first Describe - to return the actual value of the expression at runtime in Powerscript.

In order to do this, you need to strip out the

   <default_value><tab>

to get to the expression and then construct the correct Describe(Evaluate.(expr)...) function call. For more complex expressions, you definitely need to use Describe and Evaluate. The final syntax required for Describe and Evaluate to correctly evaluate the complex expression in the example is:

dw_1.Describe("Evaluate('if(isRowNew(),0,1)',3)")

To reduce redundant Powerscript coding, it is suggested that the developer write a generic function to parse out and evaluate expressions if you use complex expressions such as:

if (isRowNew(), 0,1)

or a mixture of simple and complex.

Related Documents

PowerBuilder Function Reference.


 

DOCUMENT ATTRIBUTES
Last Revised: Mar 26, 2003
Product: PowerBuilder
Technical Topics: DataWindows
  
Business or Technical: Technical
Content Id: 44421
Infotype: Technote
 
 
 

© Copyright 2013, Sybase Inc. - v 7.6 Home / Contact Us / Help / Jobs / Legal / Privacy / Code of Ethics