1 Reply Latest reply on May 20, 2015 9:20 PM by adam RSS
    ewertonm Creator

    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?



      • Query Thing by Name
        adam Creator

        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.