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

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

QueryDataTableEntries with TaggedWith does not work

OCMutz
11-Garnet

QueryDataTableEntries with TaggedWith does not work

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?

 

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

I think you are not defining the tag properly for the filter

check out the example in the helpcenter.

http://support.ptc.com/help/thingworx_hc/thingworx_8_hc/en/#page/ThingWorx/Help/Composer/Things/ThingServices/QueryParameterforQueryServices.html

 

OCMutz
11-Garnet
(To:PaiChung)

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.

PaiChung
22-Sapphire I
(To:OCMutz)

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"
              }
            ]
};

 

OCMutz
11-Garnet
(To:PaiChung)

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. 

PaiChung
22-Sapphire I
(To:OCMutz)

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

Announcements


Top Tags