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

IF…THEN – PB Docs 2018 – PowerBuilder Library

IF…THEN – PB Docs 2018

IF…THEN

Description

A control structure used to cause a script to perform a specified
action if a stated condition is true. Syntax 1 uses a single-line format,
and Syntax 2 uses a multiline format.

Syntax

Syntax 1 (the single-line format):

Parameter

Description

condition

The condition you want to test.

action1

The action you want performed if the condition is
true. The action must be a single statement on the same line as
the rest of the IF statement.

action2 (optional)

The action you want performed if the condition is
false. The action must be a single statement on the same line as
the rest of the IF statement.

Syntax 2 (the multiline format):

Parameter

Description

condition1

The first condition you want to test.

action1

The action you want performed if condition1 is true.
The action can be a statement or multiple statements that are
separated by semicolons or placed on separate lines. At least one
action is required.

condition2 (optional)

The condition you want to test if condition1 is
false. You can have multiple ELSEIF…THEN statements in an
IF…THEN control structure.

action2

The action you want performed if condition2 is true.
The action can be a statement or multiple statements that are
separated by semicolons or placed on separate
lines.

action3 (optional)

The action you want performed if none of the
preceding conditions is true. The action can be a statement or
multiple statements that are separated by semicolons or placed on
separate lines.

Usage

You can use continuation characters to place the single-line format
on more than one physical line in the script.

You must end a multiline IF…THEN control structure with END
IF (which is two words).

Examples

Example 1

This single-line IF…THEN statement opens window w_first if Num is
equal to 1; otherwise, w_rest is opened:

Example 2

This single-line IF…THEN statement displays a message if the value
in the SingleLineEdit sle_State is “TX”. It uses the continuation
character to continue the single-line statement across two physical lines
in the script:

Example 3

This multiline IF…THEN compares the horizontal positions of
windows w_first and w_second. If w_first is to the right of w_second,
w_first is moved to the left side of the screen:

Example 4

This multiline IF…THEN causes the application to:

  • Beep twice if X equals Y

  • Display the Parts list box and highlight item 5 if X equals
    Z

  • Display the Choose list box if X is blank

  • Hide the Empty button and display the Full button if none of the
    above conditions is true


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