Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi,
According to this documentation, https://support.ptc.com/help/thingworx_hc/thingworx_8_hc/en/index.html#page/ThingWorx/Help/Composer/Things/ThingServices/QueryParameterforQueryServices.html,
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.
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"
}
]
}
};
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
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