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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

How to find if a Thing name already exists

Hariharasuthan
13-Aquamarine

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 

 

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

Hariharasuthan
13-Aquamarine
(To:jensc)

hi @jensc

thanks to support,

 

Regards,

Hariharasuthan

Announcements


Top Tags