Friday, April 27, 2012

Can I use True/False instead of 1/0 when setting DataWindow attributes via Modify()?

PowerSoft says that, where appropriate, you can set boolean-type attributes using either True/False, 1/0, or ‘Y’/'N’.  For example, the following are all equivalent:
dw_1.Object.column_name.Visible = 0
dw_1.Object.column_name.Visible = False
dw_1.Object.column_name.Visible = ‘N’

Behind the scenes, PowerBuilder stores all attributes as string, regardless of whether is a boolean, long, or string.  To prove this to yourself, export a DataWindow and edit it – you’ll see that even the column colors, which are represented by a number, are enclosed in quotes.

No comments:

Post a Comment