Home      Ask a Question      My Stuff      Help   
  
Scripting - Deactivating (Without Deleting Them) And Adding Comments To Scripts
It is possible to disable all or any portion of a script, without having to delete or remove it.


Deactivate One Line of a Script
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Place "//" at the beginning of the line you wish to deactivate. This is a good method if you only have one or two consecutive lines to deactivate. Here is an example of a script that has one deactivated line:

     if (category = "Regular")
     {
     payrate = payrate1;
     //payrate = payrate2;    <--- this line will be ignored
     }



Deactivate Several Lines of a Script
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Place "/*" at the beginning and "*/" at the end of the part of the script you want to deactivate. Here is an example of a script that has a been deactivated:

     /*

     if (category = "Regular") <--- this line will be ignored
     {                                   <--- this line will be ignored
     payrate = payrate1;       <--- this line will be ignored
     }                                   <--- this line will be ignored

     */


Here is an example of how to use this to deactivate a portion of the a script, while leaving the other part active (top part):

     if (category = "Regular")
     {
     payrate = payrate;
     }

     /*

     if (category = "Regular") <--- this line will be ignored
     {                                   <--- this line will be ignored
     payrate = payrate1;       <--- this line will be ignored
     }                                   <--- this line will be ignored

     */


Add Comments to a Script
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
It is possible to use these deactivation symbols to add comments or descriptions to a script. This can be usefull if you ever need to come back to the script to make adjustments. Here is an example of a script with added comments:

     /*
     This script is for Bill       <--- this line will be ignored
     he gets a pay differential <--- this line will be ignored
     if he works over 4 hours   <--- this line will be ignored
     */
     if (home1 = "Bill" and hours > 4)
     {
     //the differential was changed to $1.50 by Amy in DEC 2010  <--- this line will be ignored
     payrate = payrate + 1.50;
     }


Note: it is possible to disable a portion of a script that the remaining portion depends on to run correctly.
ID
327
Category
Training
  FAQ's
Date Created
10/23/2008 10:58:52 AM
Date Updated
10/28/2011 4:03:40 PM
Back to Search Results