Home      Ask a Question      My Stuff      Help   
  
Scripting - The WITHIN Function
There is a function in scripting that can take the place of using several OR's in the IF expression. This can be very helpful when there are many values that must be strung together with an OR, especially since the system will only allow 20 OR's in one IF expression. The WITHIN function does not have this limitation.

The WITHIN function returns either TRUE or FALSE. So it can be used in the IF expression to test whether it is TRUE or FALSE. Keep in mind that WITHIN will be TRUE if the item you are comparing matches ANY of the values in the compare string.

How to use WITHIN:

The first item will be the variable you wish to compare (like: department, location, supervisor, home1, X, Y, Z); then a "|" (pipe) separated string of values you wish to check it against.

Note: do not use spaces, unless the value you are comparing actually does have spaces.

     within ( ItemToCompare , "string | of| values | to | compare" )

Here is a working example:

     if ( within( department , "100|110|200|210" ) = TRUE )
     {
          payrate = 15;
     }

It might help to think of the above example like this, "IF the employees department matches one of these values: 100 | 110 | 200 | 210 THEN do something..."

  
ID
680
Category
<Unassigned>
Date Created
2/10/2012 10:22:11 AM
Date Updated
2/18/2016 11:19:36 PM
Back to Search Results