5 Replies Latest reply on Apr 1, 2016 4:03 AM by veronicamih RSS
    leisel Explorer

    listing Things of a Template while omitting some Things

    I have 4 Things representing different sensors that share the same Template. I want a User to be able to select different 'Scenes' which are just different groupings of these sensors (1&2&3 or 1&3&4 etc.).

     

    The problem is, I don't know how to represent this or if there even would be a good way to do so. I was assuming I would use Lists to show the different Scenes (not to select anything, just to see the groupings). I know how to fill a list with Things based on a Template that they share, but can't find or think of a way to show the Things of a Template while omitting one or two.

     

    Is something like this possible? Is there a way to do this with/without the Template?

      • Re: listing Things of a Template while omitting some Things
        veronicamih Creator

        Hi Levi,

         

        You could omit some things that implement the same Template by creating your own version of the getImplementingThingWithData service of that template. You create your own custom service and you use if  blocks to filter out the Things you don't want to be returned by the method. The result of the service will be an infotable with the same datashape as the one used by the initial getImplementingThingsWithData service. You can then use this service to populate the list in your Mashup.

        I hope this helps,

        Veronica

          • Re: listing Things of a Template while omitting some Things
            leisel Explorer

            unfortunately I'm not very experienced in writing scripts involving thingworx data. I know it'd be an easy fix to write some IF statements, but what i'm currently working on never made it necessary to understand the syntax of the javascript combined with our thingworx type of things.

             

            A few tutorials I've watched let me do some things involving our own written scripts, but understanding them never stuck with me. Is there any tutorial/webpage that can explain the simple things that should be known before writing scripts? There's a lot I don't know but a solid starting point could clear everything up.

             

            Like if I could actually see the code of a service like "getImplementingThingsWithData" I could then understand how to do it myself. Unless I've somehow missed it, I haven't figured out a way to see the inner workings of our thingworx functions/services.

          • Re: listing Things of a Template while omitting some Things
            adrianpet Creator

            Hi,

             

               You have the option to filter. In your case, you must select the QueryImplementingthingsWithData service from your Thing Template. From the bottom right area select query(edit query) and create a Query. You will select "Add Filter" and from the listed properties just select "name", next select one of the listed properties(Starts with, Contains, Ends With or Is Exactly) and fill in the field and click the green box to add it and press ok. If you have a thingtemplate with 4 things(for example Thing1, Thing2, Thing3, Thing4)  that are using that template and you want to just list Thing2 and Thing4 in your list widget, just add filter for Contains with value Thing2 and another filter with Contains with Thing4.

             

            Thank you,

            Adrian