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

How to query implementing things by identifier?

Newbie

How to query implementing things by identifier?

Hello,

Basically the title says it all. I have things with identifiers, which are different from their names. Is there a way to find a thing by its identifier? QueryImplementingThings with the query filter on "identifier" doesn't seem to work.

Regards,

Constantine

Tags (1)
8 REPLIES 8

Re: How to query implementing things by identifier?

Constantine Kulak​,

QueryImplementingThings does not return identifier as one of the column.

You might have loop through each thing to find the corresponding identifier.

There may be a better way too.

Re: How to query implementing things by identifier?

Hello, you can do that with QueryImplementingThingsWithData. The query filter will work.

Re: How to query implementing things by identifier?

Did you try it? This query returns empty result for me, although I have a thing with identifier 12345:

ThingTemplates[“MyAssetTemplate”].QueryImplementingThingsWithData(

    { query: { "filters": { "fieldName": "identifier", "type": "EQ", "value": "12345" } } }

);

/ Constantine

Re: How to query implementing things by identifier?

That's what I'm currently doing, but it's ugly and inefficient.

Re: How to query implementing things by identifier?

I copied your code and change the ThingTemplate name and the fieldName. It works for me.

Re: How to query implementing things by identifier?

The problem is specifically with the identifier, it's a standard field, just like name or description. This query works with other (custom) fields, it doesn't work specifically with identifiers.

Re: How to query implementing things by identifier?

Okey I see. It's weird. The query works though with other standard fields like "name" or "description".

Re: How to query implementing things by identifier?

Yes, that's exactly the problem. I also opened a case with PTC Tech Support to see if they can help.