Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Example 4: displaying all data when a column allows nulls – PB Docs 2018 – PowerBuilder Library

Example 4: displaying all data when a column allows nulls – PB Docs 2018

Example 4: displaying all data when a column allows nulls

When you create an arithmetic expression that has a null value,
the value of the expression is null. This makes sense, since null means
essentially undefined and the expression is undefined, but sometimes
this fact can interfere with what you want to display.

What you want to do

A table in your database has four columns: Id, Corporation,
Address1, and Address2. The Corporation, Address1, and Address2 columns
allow null values. Using this table as the data source, you create a
DataWindow object using the four columns. You now want the DataWindow
object to display both parts of the address, separated by a
comma.

You create a computed field to concatenate Address1 and Address2
with a comma separator. Here is the expression that defines the computed
field:

When you preview the DataWindow object, if either Address1 or
Address2 is null, no part of the address displays because the value of
the expression is null. To display a part of the address, you need to
create a computed field that forces evaluation even if Address2 is null.
Note that Address2 is assumed to have data only if Address1 has data for
a particular row.

How to do it

In the detail band, create a computed field that uses the If and
IsNull functions:

The computed field says this: if the concatenation of the
addresses is null (because address2 is null), then display address1, and
if it is not null, display both parts of the address separated by a
comma.

What you get

Here is what the design of the DataWindow object looks like. It
includes both the computed field that does not work and the one that
does.

dwfct11.gif

When you preview the DataWindow object, notice that the first
computed field displays null for ABC Corporation and XYZ Corporation.
The second computed field displays the first part of the address, which
is not null.

dwfct12.gif

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