Under some special conditions, the rule cannot set the item label and the error "threw an unhandled Exception:
java.lang.IllegalArgumentException: Couldn’t invoke ‘assignValueTo’ " is thrown.
The special conditions are:
I have a Time routine:
var Timer timer1 = createTimer™ [| …
and in the timer routine all mebers of a group are iterated:
Actions on a member:
- read out the label works ok: string=actItem.label
- writing to it gives error: actItem.label=“xxx” (simple string)
- But I may write to the label at this code position if the item is specified by its name: SW01.label=“xxx”
- I may also write to label, if the iterating code is placed outside a timer routine
Had anyone same strange effects using 2.5.0 M5?
If you posted the rule code, we could have a look…
I could reduce the problem to follwoing code:
Switch Health_SW01 “Health SW01 [MAP(switch.map):%s]” (gHealth_SW)
Switch Health_SW02 “Health SW02 [MAP(switch.map):%s]” (gHealth_SW)
Switch Health_SW04 “Health SW04 [MAP(switch.map):%s]” (gHealth_SW)
Switch Health_SW09 “Health SW09 [MAP(switch.map):%s]” (gHealth_SW)
logInfo("check_Status_SW","SW - " + actSW.name + " / " + actSW.label) //ok
To set the label of an Item, you need to use the setLabel method…
May we see the logInfo output? May we see the whole error message in that context?
This reminds me of something; if I recall right, something to with trying to carry out methods on a list entry object - you need to cast as GenericItem or something like.
More edit - memory refreshed
@rossko57 “GenericItem” did solve it - may thanks
Please post the working code for others and tick the solution, thanks
Here the finally working code:
gHealth_MS.members.forEach[GenericItem actMS |
actMS.label=" Sensor - OK "