cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

How to find if a Thing name already exists

Hariharasuthan
12-Amethyst

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 

 

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

2 REPLIES 2

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

hi @jensc

thanks to support,

 

Regards,

Hariharasuthan

Top Tags