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

Do a stream query with tags filter

cbaurand
Regular Member

Do a stream query with tags filter

Hi,

 

According to this documentation,  https://support.ptc.com/help/thingworx_hc/thingworx_8_hc/en/index.html#page/ThingWorx/Help/Composer/...

we should be able to do a query with those filters:

TAGGED or NOTTAGGED filter
var query = {
            "fieldName": "tags",
            "type": "NOTTAGGED",
            "tags": [
              {
                        "vocabulary": "Applications",
                        "vocabularyTerm": "Testing"
              },
              {
                        "vocabulary": "Plants",
                        "vocabularyTerm": "Sedona"
              }
            ]
};

or with those:

var query =
{
    "filters": {
        "type": "And",
        "filters": [
            {
                "type": "GT",
                "fieldName": "Duration",
                "value": "12"
            },
            {
                "type": "TaggedWith",
                "fieldName": "tags",
                "tags": "MaintenanceIssues:PowerOutage"
            }
        ]
    }
}; 

But it seems that none of them works with tags. Can someone confirm this troubleshouting?

 

Thanks.

Tags (3)
3 REPLIES 3

Re: Do a stream query with tags filter

I have something like your second query working absolutely fine. Can you replace "TaggedWith" to "TAGGED" in your second query and test it again ? In your case it should be like:

 

var query =
{
"filters": {
"type": "And",
"filters": [
{
"type": "GT",
"fieldName": "Duration",
"value": "12"
},
{
"type": "TAGGED",
"fieldName": "tags",
"tags": "MaintenanceIssues:PowerOutage"
}
]
}
};

 

Re: Do a stream query with tags filter

Hello  mnarang,

 

Thanks for this hint,

I always tried to use TaggedWith/NotTaggedWith from TWX Help documentation and my queries still did not work.

 

This helped me a lot!

 

Tomas

Re: Do a stream query with tags filter

Hi @TomasCharvat 

 

There is a ticket already opened with R&D to investigate why TaggedWith query parameter does not give the expected result. I will update here once I get a response on the ticket. 

 

Regards,

Sachin

Announcements

Check out the upcoming Expert Session: Understanding ThingWorx Navigate Licensing in Community "Customer Events" section.