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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

How to query implementing things by identifier?

ckulak
1-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

8 REPLIES 8
ankigupta
5-Regular Member
(To:ckulak)

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.

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

qngo
5-Regular Member
(To:ckulak)

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

ckulak
1-Newbie
(To:qngo)

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

qngo
5-Regular Member
(To:qngo)

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

ckulak
1-Newbie
(To:qngo)

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.

qngo
5-Regular Member
(To:qngo)

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

ckulak
1-Newbie
(To:qngo)

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

Top Tags