Schultz’s PowerBuilder Notes

Datawindow Column Properties

The Dialog box


  • Comments are prefixed with “//”
  • A carriage return is created with <cntrl> <return>

How can I have an expression refer to the value in the previous row.

if (ba_id[-1] = ba_id, 0, 56)

How do I refer to a value in a subsequent row?

if(getrow() = rowcount(), 1, if ( vc_field_section_section_id [1] = vc_field_section_section_id , 0, 1))

Green bar Detail rows

In the color expression of the detail band:

If(Mod(GetRow(),2) = 1, RGB(255, 255, 255), RGB(127, 127, 127)

What are the values for BORDER?

<DW Control Name>.Modify(“<Columnname>.Border='<0 – None, 1- Shadow, 2 – Box, 3 – Resize, 4 – Underline, 5 – 3D Lowered, 6 – 3D Raised>'”)

How can I refer to the Datawindow Background color? (way cool)

If the row is the current row, set the background color to the datawindow background color, otherwise white.

Note, both parts of the if must evaluate to the same datatype. In this example, string result is converted to a long.


A better WordCap()

I have a column where some rows are all caps and other rows are mixed case. A simple word cap works in most cases to make the data appear nicely in a mixed case format. However, some rows which begin in mixed case are rendered to a lesser format. Example “Press/Admin” becomes “Press/admin”. Here is how I improved the description field. Beware; look at the results as YMMV.

IF( description = Upper( description ),WordCap( description ), description )

Case statement

case( job_tp when "M" then 1
when "C" then 2
when "S" then 3)


Case(salary when IS <= 5000 then 0 when IS <= 10000 RGB(0,0,255) when IS <= 20000 then RGB(255, 0, 0) else RGB(0, 255, 0) [/sourcecode]


December 10, 2008 - Posted by | 2. Datawindows, Datawindow Painter, Expressions, Modify and Describe | , , , , , , , ,

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: