infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Cloverleaf
Tcl question
David Ma
I have a tcl that has more message condition checks as following:
if {***} then
{set mykill = TURE}
if {XYZ} then {
set mykill = TURE}
.................
Is there a way that the first message hits the first IF statement then stop going to check the second or third IF statement and check the second message? It will save some message process time in the engine.
Find more posts tagged with
Clovertech
Comments
Boris Perov
if {***} {
set mykill TURE
} elseif {XYZ} {
set mykill TURE
}
Alfred Cox
Use an IF- ELSE instead of just IF. Like so:
if {***} {
set mykill = TRUE
} else {
if {XYZ} then {
set mykill = TRUE}
}
Paul Bishop
Another option if the same field is being checked in all the conditions is to use the switch command.
switch -exact -- $field_to_check {
"value 1" {action to take}
"value 2" {action to take}
...
default {action to take}
}
There are two other options besides -exact: -glob and -regexp. The "--" marks the end of the options, and the "default" entry is the action taken if no match is made.
David Ma
Thanks all!
I mean if the first IF statement match, then tcl will not check the second ELSE IF statement. the TCL will stop after the first IF statemnet and start checking the second message. something like using if {ABC is ture} then { lappend dispList "KILL $mh"}
Charlie Bursell
What Boris gave you above is exactly what you ask for. If the first if statement evaluates true then the elseif will not be evaluated. That is the purpose of elseif.