How to correctly handle user input in program nodes

HI all,

Currently when I add more than one program node. The user inputs is copied over to all of them. So for example:

If the user selects WR:OPEN_DOOR and Set : 1 on the node on line 5. Every single other node also has this value. The same applies if u change anything in the other nodes. The rest will have the same values.

Does anyone know what the issue here is? How can I solve this?

I had the same problem but i don’t remember exactly the solution. I think it was a mistake with the naming of the datamodel variables.

Are you setting the view of the buttons up properly in the “OpenView” of each program node? You need to grab the data from your dataModel and then set the dropdown and buttons to the state the datamodel says it should be in.

1 Like

Are you writing to a static datamodel or something? Or writing to the installation node’s datamodel?

The Program Node’s Service class instantiates a new, unique datamodel when the node is created:

I then assign the passed model from the constructor to another (identically named) local variable. I don’t think this is necessary, but I’ve always done it sooooo

Otherwise like @nrivas has suggested, in the openView() method, you should be setting the state of all the controls to the model.get()'s output of each control. Without seeing any of your Java code, the best we can do is guess.

Thank you @nrivas and @eric.feldmann ! I looked over my code again and noticed I hadn’t fully implemented the OpenView methods. After implementing it everything works like it is supposed to.