Home      Ask a Question      My Stuff      Help   
  
Scripting - IF Statements Inside IF Statements
This article will explain how to use multiple levels, or tiers, of "IF" statements.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

This is useful when you need to apply a custom rule to a very specific group of employees. In the following examples we will start with a one "level" script and then add levels to it.

In the first example, lets say you wanted the group of employees in the "Office" location to get a pay differential, you could write this:

     if (location = "Office")
     {
     
          payrate = payrate + 1.00

     }


Now we will add an additional level of IF statements, that will specify the differential amount, based on the Employee's Home Supervisor:

     if (location = "Office")
     {
          if (supervisor = "John")
          {
               payrate = payrate + 1.00
          }

          if (supervisor = "Amy")
          {
               payrate = payrate + 2.00
          }
     }


Keep in mind that you do not need to indent the script like we did in the above examples (you are welcome to though). We only indented it like that because it makes it much easier to explain.

For more information, please see the other "IF Statement" article links below.
ID
99
Category
Training
  FAQ's
Date Created
1/25/2007 10:05:57 PM
Date Updated
10/27/2011 2:55:10 PM
Back to Search Results