If Control Statement
if <condition> then
[else if <condition> then
<commands>] end if
You can use the if control statement to facilitate an invoicing system in which customers with purchases of less then $10,000 receive a 5% discount, and customers with purchases more than $10,000 receive a 10% discount.
2. Enter a dollar amount into the field.
3. If...then statements cannot be issued from the Message Box, so create a button with the following script:
put field "sales" into sales if sales > 10000 then
put 10 into discount else
put 5 into discount end if
The If...then construction in the previous example is relatively simple, because only one command is used after then and else. It is possible, however, to use several commands. Change your button's script to look like the following:
put field "sales" into sales If sales > 10000 then
put 10 into discount
put sales/100*90 into total else
put 5 into discount
put sales/100*95 into total end if
type discount &
This text has been mechanically extracted from the Oracle Media Objects 22.214.171.124 MediaTalk Reference, © 1995 Oracle Corporation, and is provided here solely for educational/historical purposes.