Skip to main content
13-Aquamarine
Apr 20, 2023 12:07 PM UTC
Solved

How to find if a Thing name already exists

dear expert  

ThingName already exists or not how to find any services , any script share 

 requirement:

I write JavaScript code ,how to compare already  thingName present or not 

 

jenscAnswer
17-Peridot
Apr 20, 2023 1:21 PM UTC

Hello,

 

There is a way to see if a thing with a specific name already exists.

 

Here is some code to achieve this:

result = 'thing doesnt exist';
let thingName = 'YourThingName';
if (Things[thingName]) {
 result = 'thing exist';
}

This code will check if there is a thing with the name that you have already exists or not.

 

Regards,

Jens

2 replies

jensc17-PeridotAnswer
17-Peridot
Apr 20, 2023 1:21 PM UTC

Hello,

 

There is a way to see if a thing with a specific name already exists.

 

Here is some code to achieve this:

result = 'thing doesnt exist';
let thingName = 'YourThingName';
if (Things[thingName]) {
 result = 'thing exist';
}

This code will check if there is a thing with the name that you have already exists or not.

 

Regards,

Jens

Translate
13-Aquamarine
Apr 21, 2023 4:26 AM UTC

hi @jensc

thanks to support,

 

Regards,

Hariharasuthan

Translate