FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
06-05-2023 10:34 PM
I'm writing a custom widget that requires two different variable subscriptions. I wanted to use the "name" parameter of the onSetValue function to determine which variable is which. I expected this to return a text reference to the data attribute in WebIQ designer ('item' for the standard WebIQ widgets), but instead it returns the name of the process variable.
Is this the intended functionality? If so, how can I differentiate between multiple subscribed items on a single widget?
Solved! Go to Solution.
06-06-2023 07:26 AM
Yes, that is the intended functionality. To determine which item is passed, just check the configured items. You do not tell, the item names you configured in the json file, therefore I just use 2 example names.
Example:
onSetValue: async function (value, type, name) {
if (name === self.config.myItem) {
// any action
} else if (name === self.config.itemSetPoint) {
// any action
}
}
06-06-2023 10:50 PM
Thank you!