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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. 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.



Top Tags