Open rogeda opened 5 years ago
I guess if you can change the file "osisoft-web-api.js" at the following point:
case "path": if (config.piDB === null || config.piDB.length === 0 || config.piTag === null || config.piTag.length === 0) {node.error(RED._('web-api.errors.path-element-missing')); } else { node.piDB = config.piDB; node.piTag = config.piTag;
You can subsitute for:
case "path": if (config.piDB === null || config.piDB.length === 0) {node.error(RED._('web-api.errors.path-element-missing')); } else { node.piDB = config.piDB; if (config.piTag === null || config.piTag.length === 0) { node.piTag = msg.piTag; } else { node.piTag = config.piTag; }
I guess that doing that, if the node property piTag is left blank, then the node will read the tag name direct from the node msg.piTag.
It´s possible to test this feature? Thanks.
I change here locally the file osisoft-web-api.js and yes, it works!!!
If u leave the PI tag property blank, the node pick the "msg.piTag" value.
This helps to dynamically change the tag name in order to read different tags using one node "web api query"!!
Have only to pay attention to create the property value on the node-red msg object.
Another change that i made in the file is to let the flow to catch the error if the tag doesn´t exists, for example.
To do that, i changed the line in the file that says:
node.error(e);
to
node.error(e, msg);
I tested and worked too.
Now i can catch and treat the PI error on the "Catch node";
Thanks.
osisoft-web-api.LOG
PS.: I change only the throw error line for the option "path" on function webApiQueryNode. The other, i left unchanged, but i guess that would be better change too!
Hi, I would like to know how to dynamically change the "PI tag" property on node "web api query" so i would be able to query tags using only one "web api query" node and changing the tag name. Thanks in advance. Ogeda, Renato.