MangoES - DGLux How to use Popup shared by multiple Buttons - passing different data point to Popup
-
I am working on a DGLux screen on our customer's MangoES unit. The screen shows the information for 15 scales that keep track of different materials (Sand/Gravel conveyor belts) processed at different parts /areas of the plant. The scales are all the same except for the IP address (Modbus IP) and "name". We have data points that we read to show/display the current cumulative weight processed during the shift as well as some other information.
I want to create one pop up dialog that comes up whenever any of the 15 different scales "reset button" is clicked (button at the end of each scales data information row). From there, the dialog will allow the operator to reset that particular scale daily total.
I want to use the SAME popup and feed it different parameters (the scale name and the IP Address datapoint that holds the reset data register). The operator can then confirm that the data point (scale) should be reset. They click "yes" and the data action occurs to the specific scale ... resetting the weight back to zero (similar to a car odometer "trip meter").
To put another way, we want the popup to operate like a function call, passing the name and Modbus IP data point address for the button that was clicked and then show that name in the popup and operate on the data point to reset that specif scale.
Is this possible to do ... ie: pass the name and data point to the popup and have that be dynamic per the button that is clicked?
Are then any video tutorials that could help me on this or do you have any hints/ideas on how to do this or think that this is even possible? The other option is to create a different popup for each scale, but then we have MANY almost identical popup dialog boxes. -
Hi truesch,
This is definitely possible.
My initial reaction would be to try it like this:
- Every scale's 'reset button' has a behavior that sets a dynamic property value of a script element to the name of the scale to reset. Add another behavior to the reset buttons set to execute the script after previous (the property set action).
- In the script, have it just do some transformation of the incoming name to the various paths for the reset, and assign these to dynamic property variables.
switch( scaleName ) { //scaleName is the name of the dynamic property the reset button behavior sets case "scale1" : //this is the value the first scale set the scaleName property to. //dailyTotalPath is the name of a dynamic property on the script dailyTotalPath = "/Root/Scales/scale1/dailyTotal"; //this is the the path in the hierarchy to the dailyTotal point break; case "scale2" : .... default : dailyTotalPath = "Hopefully this doesn't happen, but choose your default however you wish" openPopup = true; //This is the name of a trigger dynamic property on the script. By setting it true, we'll trigger it.
- Create a behavior for openPopup on the script which moves your popup to the right position and possibly animates it open, or some other means of making it visible.
- Create an input field on the popup, create a save data behavior on the 'enter' action. Bind the dailyTotalPath from the script's dynamic properties to the path of the save data behavior. Bind the value of the input field to the value to set.
- Create some means to close the popup.
And you're done!
-
Thank you for the quick reply. I will give this a try. It may take a bit for me to digest and figure out a few other things in addition to the info here in order to finish. I hope to get back and post details of a successful result.