# Get name of configuration node

**URL:** <https://discourse.nodered.org/t/get-name-of-configuration-node/62407>\
**Category:** General\
**Created:** [9 May 2022 14:20 UTC](https://discourse.nodered.org/t/get-name-of-configuration-node/62407 "2022-05-09T14:20:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Blovorad](https://avatars.discourse-cdn.com/v4/letter/b/e9bcb4/32.png) [@Blovorad](https://discourse.nodered.org/u/Blovorad)\
**Post date:** [9 May 2022 14:20 UTC](https://discourse.nodered.org/t/get-name-of-configuration-node/62407/1 "2022-05-09T14:20:11Z")

</div>

Hello, i will try to explain my idea. I don't know if it is possible but when you have configuration node i want to know if i can, with function node or other, get the name of the configuration node.  
You can look on this picture what i mean

 ![photo_node_red](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/6/169a17a5791e9768b1144bae8b35d444619d35eb.jpeg)  
I want to get what is behind red color. Or if i'm doing a SQL request if i can know the source of the target, SGBD name i mean.  
It is to have a easy way to detect if a SQL error occure i can see if SGBD is the good SGBD.

Thanks for futur answer !

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [9 May 2022 21:03 UTC](https://discourse.nodered.org/t/get-name-of-configuration-node/62407/2 "2022-05-09T21:03:44Z")

</div>

> [@Blovorad](#):
>
> with function node or other, get the name of the configuration node.

Hi @Blovorad,  
Don't think that will be easy, but I might be mistaken!!!

You say with a function node, so you want to get the name of a config node on the server-side.  
Because the code in a function node will be executed as soon as a message enters the function node, which is running in your flow on the server. Correct?

I did something similar [here](https://github.com/bartbutenaers/node-red-contrib-msg-profiler/blob/main/time_profiler.js#L51) to get the name of a node. You could use another if-condition to search for a specific node: `if(someNode.id != someNodeId)`.

However then you get the name of a node, i.e. the value entered manually by the user in the node's config screen:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/7/27430f00fbbc8e90d2788a4f2d3e95e7c5928c8b.png)

However when you leave the Name field empty in the config screen, you will see the default name of that node in the sidebar:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/7/f75d17009de66aedd2bf0a87e59d6852c53a1198.png)

That default name is generated inside the client side code of that node (i.e. in its html file). For this particular node you can find that code [here](https://github.com/Anamico/node-red-contrib-alarm/blob/master/alarm/panel.html#L8):

```auto
label: function() {
   return this.name || "Panel";
}

```

Which means it uses the hardcoded string "Panel" if the name field is empty.

I assume my loop will return an empty string in that case (instead of "Panel"), because my loop will run on the server side. But _ **you will need to test that** _. However if I am correct, you won't get the same text as in the sidebar if the Name field is empty...

> [@Blovorad](#):
>
> Or if i'm doing a SQL request if i can know the source of the target, SGBD name i mean.  
> It is to have a easy way to detect if a SQL error occure i can see if SGBD is the good SGBD.

I have the impression that you are trying to find a bad workaround (via the config node names) for your problem. But I might again be completely mistaken!

Perhaps if you describe your problem a bit more in detail, people can assist you to find a decent solution.

Bart

---

<div class="post-metadata">

**Author:** ![Blovorad](https://avatars.discourse-cdn.com/v4/letter/b/e9bcb4/32.png) [@Blovorad](https://discourse.nodered.org/u/Blovorad)\
**Post date:** [10 May 2022 07:17 UTC](https://discourse.nodered.org/t/get-name-of-configuration-node/62407/3 "2022-05-10T07:17:51Z")

</div>

To explain a bit more my problem :  
For fast debugging my boss demands me to print on a dashboard which BDD are currently in use in SQL request (with node MSSQL), so i see that bdd are directly enter in configuration nodes so my first approach was to get the current name in configuration nodes. But perhaps with MSSQL node we can know what bdd are in use.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [10 May 2022 19:17 UTC](https://discourse.nodered.org/t/get-name-of-configuration-node/62407/4 "2022-05-10T19:17:04Z")

</div>

> [@Blovorad](#):
>
> which BDD are currently in use in SQL request (with node MSSQL)

I don't know anything about SQL Server, but I assume BDD's mean Balanced Data Distributor's?

And which nodes are you using? Because I see that there are a lot of mssql nodes available in the palette...

My thoughts:

1. Or you try to loop the config nodes like in the code snippet I shared above. You can have a look at the properties of those config nodes, and most likely you can find the bdd info inside some property of those config nodes. If you can see the bdd info on top of the config node (in the sidebar), then the node must contain that information somewhere in a property...
2. Or indeed you try to access the bdd information via the mssql nodes, if that functionality is available.

---

<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:** [9 July 2022 19:17 UTC](https://discourse.nodered.org/t/get-name-of-configuration-node/62407/5 "2022-07-09T19:17:10Z")

</div>

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