Hi,
In my rule I initially had this:
val in_UDPmsg = Tex_UDP_Receive.state.toString.substring(0, Tex_UDP_Receive.state.toString.length)
This works fine.
However, I wanted to add an if statement. So it became this:
if (Tex_UDP_Receive.state.toString.length > 6 ) {
val in_UDPmsg = Tex_UDP_Receive.state.toString.substring(0, 6)
} else {
val in_UDPmsg = Tex_UDP_Receive.state.toString.substring(0, Tex_UDP_Receive.state.toString.length)
}
But this generates a lot of errors:
2017-05-24 14:33:11.174 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'texecom.rules', using it anyway:
The value of the local variable in_UDPmsg is not used
The value of the local variable in_UDPmsg is not used
2017-05-24 14:33:11.175 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'texecom.rules'
2017-05-24 14:33:19.597 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'Alarm interface via UDP': An error occured during the script execution: The name 'in_UDPmsg' cannot be resolved to an item or type.
I don’t understand why, since in_UDPmsg is defined?
I also tried this:
val in_UDPmsg = Tex_UDP_Receive.state.toString.substring(0, Tex_UDP_Receive.state.toString.length)
if (Tex_UDP_Receive.state.toString.length > 6 ) {
val in_UDPmsg = Tex_UDP_Receive.state.toString.substring(0, 6)
}
This is essentially the same. I one get an error message when my rules-file is saved, but not when the rule is being executed:
2017-05-24 15:26:56.161 [INFO ] [el.core.internal.ModelRepositoryImpl] - Validation issues found in configuration model 'texecom.rules', using it anyway:
The value of the local variable in_UDPmsg is not used
2017-05-24 15:26:56.162 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'texecom.rules'
What am I doing wrong?