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

Query all implemented thing with filter

srudenkov
1-Newbie

Query all implemented thing with filter

I have such thingShape:

name: STRING

report: TEXT

internalThing(ccr): Thing Name

I would like to Query all implemented things that doesn't have internalThing.

I tried QueryAllImplementedThings service of my Template

Selection_035.png

I don't see any negative predicates.

5 REPLIES 5
PaiChung
22-Sapphire I
(To:srudenkov)

You may need to use a custom Service

if you look at the Query parameters available: Query Parameter for Query Services

There is NE, NOTLIKE, NOTIN

Pai Chung, thank you for answer. Could you, please, be more specific about where I should pass my query code?

Lets say I have chosen thise code to be my filter:

var query = {
     filters: {
          type: "MissingValue, NotMissingValue",
          fieldName: "OrderQuantity"
     }
};

Should I pass it as String into "query" param of QueryAllImplementedThings? Should I implement my own service for it?

Thanks in advance!

I created service GetPRwithoutCCR ​with corresponding code inside:

var query = {

    filters: {

        type: "EQ",

        fieldName: "name", value: "AAA"

    }

};

result = query;

Selection_038.png

But I am proceeding get all implemented things without applying filter. What am I doing wrong?

PaiChung
22-Sapphire I
(To:srudenkov)

The data being filtered is the result coming back from QueryImplementingThingsWithData not your own GetPRWithoutCCR service.

So if your GetPRWithoutCCR is the right service, then the Query has to be passed into that service and applied to the recordset within that service.

If QueryImplementingThingsWithData is at the basis of that service, then invoke that server side within GetPRWithoutCCR applying the query at that time and then moving on from there to produce the proper output.

Right now you are calling each service individually and they are returning their own recordset to the client.

rnayak-2
5-Regular Member
(To:srudenkov)

Are you invoking the QueryImplementingThingsWithData after your Query service runs ? If not then QueryImplementingThingsWithData service may be running with an empty input query as it is being triggered before or at the same time as your query service...  check if invoking it after solves your problem !!


For brevity I think its always good  practice to follow what Pai suggested in a prior reply.

Top Tags