ASSIGN VARIABLE BY UI-ACTION

Hi all,

I need to assign variable each other by using UI-Action as below.

For example: I have 2 objects to control: Motor 01 & Motor 02. Each motor has its variable :

+ Motor 01: M01_Start, M01_Stop, M01_Run;ย 

+ Motor 02: M02_Start, M02_Stop, M02_Run;ย 

And common variables which are assigned to Pop up window when click to each object. Those variable will be assigned to specific motor to control.ย 

You can refer to pictures below for understanding.

In this case if I click to Motor 01 then I need M01_Start = CMD_Start; M01_Stop = CMD_Stop the same for Motor 02.

My question is to how can I assign those variables and then I can only use CMD_Start & CMD_Stop to control all of my objects?

I was thinking about WriteDirect() function but it seems only support for one Item & one value.

Could you please help to give some ideas for this? UI-Action code is highly appreciated.

Thank you and hope to get your feedback soon.

Regards!

Best reply by webiq-sk

What's actually wanted here is to change item names used inside widgets when the user clicks on a pump.

So the popup opened when the user clicks on the pump widget should use all of the items specific to that pump.

For this the popup has to be put inside a composite widget and placeholders have to be used. Then when the user clicks on the pump the UI Action "composite-placeholders" is used to modify the item names used in the widgets in the popup for the specific pump, then the popup will be opened by the UI Action "popup-menu".

I have attached a working demo that illustrates this. This works best if all of your items only differ in a single part of the item, like "pump[4].speed" - then a single placeholder for replacing the offset would be sufficient as shown in the demo.

composite_placeholders_demo.zip
2.6MB
View original
6 replies