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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

how to know if a value is in a infotable

fmanniti
10-Marble

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?

5 REPLIES 5

Don't thing so.

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

Carles.

Hoped there was a less complex way.

Thanks

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.

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?

I would go for the Iterating way, if it starts to go slow ( really huge amount of things ) then I will start applying performance improvements.

Announcements


Top Tags