5 Replies Latest reply on Nov 11, 2016 12:25 PM by carlesc RSS
    fmanniti Creator

    how to know if a value is in a infotable

    I have a thing template with a infotable property.

    I would like to call the service QueryImplementingThingsWithData and my query should be on the infotable property.


    In other words I want to select all things of the template which have my input value into one row of the infotable property.

    Is it possible?

      • Re: how to know if a value is in a infotable
        carlesc Ninja

        Don't thing so.

         

        You should iterate over QueryImplementingThingsWithData entities and "refilter" for the ones that comply with Infotable Value Condition.

         

        Carles.

          • Re: how to know if a value is in a infotable
            fmanniti Creator

            Hoped there was a less complex way.

            Thanks

            • Re: how to know if a value is in a infotable
              pbaierl Creator

              You could also create your output own info table.

              Iterate through the results of the  QueryImplementingThingsWithData service.  Add each row/thing that contains the desired value to your output table.

              This would allow you to get everything you need in a single loop.


              Another way to do this would be change the visibility settings for the things that do not contain the desired value.  QueryImplementingThingsWithData will only return things that the current user has visibility permission to see.

                • Re: how to know if a value is in a infotable
                  fmanniti Creator

                  Mh, wait, I don't know if I got it right; I'll be more explicit, so it would be easier to explain:

                   

                  ThingTemplate: My_Template

                  Things from My_Template: Thing1, ..., Thingn

                  Property: Fathers (INFOTABLE). FatherName (STRING), FatherType (STRING).

                  (In turn, Fathers infotable, will be populated by the name and type property of other things).

                   

                  I want to know which things from My_Template have, for example, "Pippo" in FatherName.

                   

                  If my property Fathers was just a string instead of an Infotable I would have done something like this:

                   

                  var query = {

                    "filters": {

                      "fieldName": "Fathers",

                      "type": "EQ",

                      "value": "Pippo"

                    }

                  };

                  var infotable_result = ThingTemplates["My_Template"].QueryImplementingThingsWithData({query: query});

                   

                  but since Fathers is not a string but a Infotable, I cannot do it this simple.

                   

                  Am I right or you mean something different?