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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Query Thing by Name

emoreira
12-Amethyst

Query Thing by Name

Trying to create a service query a Thing by name and check if it exists or not, but it seems I am having trouble with the Syntax. I looked at the Wike and tried to use the syntax there, but still get empty results.


Anybody knows an easy way to do it?


thanks

E



1 REPLY 1
adam11
5-Regular Member
(To:emoreira)

Hi Ewerton,

If you want to see if a Thing exists, you can do:


if (Things[thingName]) {

 // It Exists

} else {

  // It Doesn't

}


If the Thing does not exist, Things[thingName] will be null, which evaluates to false in a conditional.



Announcements


Top Tags