CHOOSE CASE TRUE for a series of validations


Link to this posting

Postby Ursego » 19 Feb 2013, 22:14

Use one compact CHOOSE CASE TRUE block to "pack" a series of Boolean expressions and/or Boolean functions.

So, instead of

Code: Select all
if not IsValid(ads) then
   ls_err = "Passed datastore is not valid"
end if

if ls_err = "" and IsNull(al_row) then
   ls_err = "Passed row cannot be null"
end if

if ls_err = "" and al_row < 1 then
   ls_err = "Passed row must be greater than 0"
end if

write

Code: Select all
choose case true
case not IsValid(ads)
   ls_err = "Passed datastore is not valid"
case IsNull(al_row)
   ls_err = "Passed row cannot be null"
case al_row < 1
   ls_err = "Passed row must be greater than 0"
end choose
User avatar
Ursego
Site Admin
 
Posts: 143
Joined: 19 Feb 2013, 20:33



Ketones are a more high-octane fuel for your brain than glucose. Become a biohacker and upgrade yourself to version 2.0!



cron
Traffic Counter

eXTReMe Tracker