Reply To: need tcl code to check multiple fields for value

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf need tcl code to check multiple fields for value Reply To: need tcl code to check multiple fields for value

#57821
Jonathan Hamilton
Participant

    Look up both field values then do a compound if statement.

    if {[cequal $field1 “bad value”] && [cequal $field2 “other bad value”]} {

       lappend dispList “KILL $mh”

    } else {

       lappend dispList “CONTINUE $mh”

    }

    If you have multiple text comparisons you may need to use switch to keep it managable.

    switch -exact — $field1 {

       bad_value1 – bad_value2 – bad_value3 {set field1Trigger 1}

       default {set field1Trigger 0}

    }

    switch -exact — $field2 {

       bad_value5 – bad_value6 {set field2Trigger 1}

       default {set field2Trigger 0}

    }

    if {$field1Trigger && $field2Trigger} {

       lappend dispList “KILL $mh”

    } else {

       lappend dispList “CONTINUE $mh”

    }

    Hope that is what you’re looking for.

    Jonathan