# OPC UA dynamical namespaces index

**URL:** <https://discourse.nodered.org/t/opc-ua-dynamical-namespaces-index/30613>\
**Category:** General\
**Created:** [23 July 2020 15:25 UTC](https://discourse.nodered.org/t/opc-ua-dynamical-namespaces-index/30613 "2020-07-23T15:25:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pfe](https://avatars.discourse-cdn.com/v4/letter/p/49beb7/32.png) [@pfe](https://discourse.nodered.org/u/pfe)\
**Post date:** [23 July 2020 15:25 UTC](https://discourse.nodered.org/t/opc-ua-dynamical-namespaces-index/30613/1 "2020-07-23T15:25:07Z")

</div>

Hello Forum,

I search a way to define the nodeid dynamically in a read flow for a OPC client . instead of ( fixed ns index)  
**ns=10;s=Devices.CmdChangeRequest**  
something like:  
**global.get('namespace');s=s=Devices.CmdChangeRequest**  
but I get an error :  
Error: String cannot be coerced to a nodeId : global.get('namespace');s=Devices.CmdChangeRequest  
Is there a way to do it?  
Thanks a lot.

---

<div class="post-metadata">

**Author:** ![pfe](https://avatars.discourse-cdn.com/v4/letter/p/49beb7/32.png) [@pfe](https://discourse.nodered.org/u/pfe)\
**Post date:** [25 July 2020 05:30 UTC](https://discourse.nodered.org/t/opc-ua-dynamical-namespaces-index/30613/2 "2020-07-25T05:30:43Z")

</div>

ok. this can be done with a function after the node.. but Is it possible to evaluate something directly in the property? with $eval? An other way to solve it to fork the node and add the namespace as a property..  
No suggestion?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [25 July 2020 07:54 UTC](https://discourse.nodered.org/t/opc-ua-dynamical-namespaces-index/30613/3 "2020-07-25T07:54:18Z")

</div>

Hi, you don't mention exactly which node you are using so tricky to guess as I don't use OPC-UA - How dynamic do you need it ? If per runtime then you may be able to set it in the node by using an environment variable like ${MY\_OPC\_READ\_CONFIG} and set that externally to Node-RED to the complete `ns=10;s=Devices.CmdChangeRequest` string. Or using a function node or template node before sending to the node is probably the easiest way as you suggest.

You may want to discuss withe the node's author but I think breaking apart that string while attractive, may break the operation of the node - or at least break existing users - unless designed carefully.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [23 September 2020 07:54 UTC](https://discourse.nodered.org/t/opc-ua-dynamical-namespaces-index/30613/4 "2020-09-23T07:54:19Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
