Course Index Section Start Previous Slide Next Slide 13

A Script Node Primer

Task: Invert Boolean output from one field to another

Method: Simple script to reverse the values, and then ROUTE it between two fields

    DEF FlipBoolean Script {
      eventOut     SFBool      outBool
      eventIn      SFBool      inBool
      url "javascript:function inBool(value, time) {
               if (value == TRUE) {
                   outBool = FALSE;
               } else {
                   outBool = TRUE;
               }
           }"
    }
    ROUTE source.isActive TO FlipBoolean.inBool
    ROUTE FlipBoolean.outbool TO target.isActive