Jump to content

condition "selectCase"


---
 Share

Recommended Posts

Hello everybody,
I have a question about the condition "selectCase".
I would like to process the following procedure with the condition "selectCase".
Unfortunately it does not work. Is this even possible with "selectCase"?
The line "display ..." I would replace in the case of application, it is now only for testing.

NUT=0
OFFSET=0

inquireParameterList("NUT","V_NUT messen ?","OFFSET","OFFSET messen ?")

// Abfrage des gewählten Messplan

if (NUT==0 and OFFSET==0) then
display("MessPlan = "+0)
endif

if (NUT==0 and OFFSET==1) then
display("MessPlan = "+1)
endif

if (NUT==1 and OFFSET==0) then
display("MessPlan = "+2)
endif

if (NUT==1 and OFFSET==1) then
display("MessPlan = "+3)
endif
Link to comment
Share on other sites

I have not been able to get select case to work, but with a little tweak your code works just the same. Try adding a closing bracket around each boolean test.

NUT=0
OFFSET=0

inquireParameterList("NUT","V_NUT messen ?","OFFSET","OFFSET messen ?")


if (NUT==0) and (OFFSET==0)
display("MessPlan = "+0)
endif

if (NUT==0) and (OFFSET==1) then
display("MessPlan = "+1)
endif

if (NUT==1) and (OFFSET==0) then
display("MessPlan = "+2)
endif

if (NUT==1) and (OFFSET==1) then
display("MessPlan = "+3)
endif
Link to comment
Share on other sites

selectCase works just fine, how ever, if you are making an comparison for equal, you need to add "is".
selectCase list(1, 2, 3, 4, 5).shuffle.first
case is == 1 
   Syntax
case > 3
   Syntax
caseElse
   Syntax
endSelect
(With reservation for syntax error, sittning on a park bench and typing on my Phone.)

So you could use this in your case:
selectCase NUT.asString+OFFSET.asString
	case is == "00"
		display("MessPlan = "+0)
	case is == "01"
		display("MessPlan = "+1)
	case is == "10"
		display("MessPlan = "+2)
	caseElse
		display("MessPlan = "+3)
endSelect
Link to comment
Share on other sites

 Share

×
×
  • Create New...