if v_day in ('SATURDAY', 'SUNDAY') then
-- do something
end if;
choose case ls_day
case 'SATURDAY', 'SUNDAY'
// do something
end choose
lb_weekend = (ls_day = 'SATURDAY' or ls_day = 'SUNDAY')
lb_weekend = iin(ls_day, {'SATURDAY', 'SUNDAY'})
string ls_days[] = {'SATURDAY', 'SUNDAY'}
lb_weekend = iin(ls_day, ls_days[])
if iin(ll_employee_id, {123, 456, 789}) then
$PBExportHeader$iin.srf
global type iin from function_object
end type
forward prototypes
global function boolean iin (string as_val, string as_arr[])
global function boolean iin (ref powerobject ao_val, ref powerobject ao_arr[])
global function boolean iin (long al_val, long al_arr[])
end prototypes
global function boolean iin (string as_val, string as_arr[]);
int i
int li_upper_bound
li_upper_bound = UpperBound(as_arr[])
for i = 1 to li_upper_bound
if as_arr[i] = as_val then
return true
end if
next
return false
end function
global function boolean iin (ref powerobject apo_val, ref powerobject apo_arr[]);
int i
int li_upper_bound
li_upper_bound = UpperBound(apo_arr[])
for i = 1 to li_upper_bound
if apo_arr[i] = apo_val then
return true
end if
next
return false
end function
global function boolean iin (long al_val, long
al_arr[]);/**********************************************************************************************************************
Dscr: Reports if a value, passed as the 1st argument, appears in the array, passed as the 2ndt argument.
Mimics the action of SQL's IN clause.
Overloaded for string (serving also char), long (serving also int) and PowerObject.
To see the overloads, open the function in the "Edit Source" mode.
Examples of use:
if iin(ll_cust_id, ll_best_customers[]) then...
if iin(ls_city, ls_best_cities[]) then...
if iin(acb_clicked, lcb_buttons[]) then...
List of values can be inserted inline using brackets - {..., ...} - to avoid the need to declare an array:
if iin(ll_cust_id, {123, 456, 789}) then...
if iin(ls_city, {"Toronto", "Ottawa"}) then...
if iin(acb_clicked, {cb_ok, cb_cancel}) then...
-----------------------------------------------------------------------------------------------------------------------
Arg: value to be checked (string, long or PowerObject)
array to search in (must be the same type as the first argument)
-----------------------------------------------------------------------------------------------------------------------
Ret: boolean
-----------------------------------------------------------------------------------------------------------------------
Log: 10may2012 Michael Zuskin Initial version
**********************************************************************************************************************/
int i
int li_upper_bound
li_upper_bound = UpperBound(al_arr[])
for i = 1 to li_upper_bound
if al_arr[i] = al_val then
return true
end if
next
return false
end function
global function boolean iin (ref powerobject apo_val, ref powerobject apo_arr[]);