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

how to know if a value is in a infotable

Highlighted
Granite

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?

Tags (2)
5 REPLIES 5
Highlighted

Re: how to know if a value is in a infotable

Don't thing so.

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

Carles.

Highlighted

Re: how to know if a value is in a infotable

Hoped there was a less complex way.

Thanks

Highlighted

Re: how to know if a value is in a infotable

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.

Highlighted

Re: how to know if a value is in a infotable

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?

Highlighted

Re: how to know if a value is in a infotable

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

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum!