Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
I am trying to filter a DataTable using QueryDataTableEntries for a column that contains tags.
According the the documentation I am using this filter expression (where type of field Context is TAGS and Tag type is Model Tags), but the filter does not seem to have any effect:
let filters = {
"filters":
{
"type": "NotTaggedWith",
"fieldName": "Context",
"tags": "PTC:factory-mv"
}
};
let result = me.QueryDataTableEntries({
values: undefined /* INFOTABLE */,
maxItems: 500 /* NUMBER */,
tags: undefined /* TAGS */,
source: undefined /* STRING */,
query: filters /* QUERY */
});
I also tried to get all the data, put it into an Infotable and query that one with the same effect.
Can anyone help on this?
I think you are not defining the tag properly for the filter
check out the example in the helpcenter.
Hi,
this is an exerpt from the help center:
"filters": {
"type": "And",
"filters": [
{
"type": "GT",
"fieldName": "Duration",
"value": "12"
},
{
"type": "TaggedWith",
"fieldName": "tags",
"tags": "MaintenanceIssues:PowerOutage"
}
]
}
To me it looks quite similar to what I wrote above exept that I do not have an additional and expression.
That's interesting ... I looked at the Help center 8/9 and it has it slightly different, which shows each tag as a JSON pair, maybe try it this way? If this works, then probably need to bug whereever that example came from
var query = {
"fieldName": "tags",
"type": "NOTTAGGED",
"tags": [
{
"vocabulary": "Applications",
"vocabularyTerm": "Testing"
},
{
"vocabulary": "Plants",
"vocabularyTerm": "Sedona"
}
]
};
To my understanding that is the way to query for data tags. I want to query for a column with Model tags. The syntax for that is on the same help page more at the bottom. By the way I already did try various combinations of both variants without success.
So if anybody has a working example on how to filter for model tags in a column I would be happy to have a look at it.
There won't be any model tags with QueryDataTableEntries since it specifically only queries data that is within a DataTable
If you've somehow added Model Tags as entries within a DataTable, I recommend you use a String type search