Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
Windchill 11.1
OData API 2.2.2
Hello all,
I am trying to retrieve / filter on classification (parts) via the OData classification search, However, data types are either not mapped correctly or I need to use a different leaf node - I just do not know which one.
Here are some examples:
1) Filtering by a boolean attribute:
WORKS:
Request:
/Windchill/servlet/odata/v3/ClfStructure/ClfNodes('NODE_NAME')/ClassifiedObjects?$filter=ClassificationAttributes/any(d:d/InternalName eq 'SOME_ATTRIBUTE' and d/DisplayValue eq 'true')
DOES NOT WORK:
Request:
/Windchill/servlet/odata/v3/ClfStructure/ClfNodes('NODE_NAME')/ClassifiedObjects?$filter=ClassificationAttributes/any(d:d/InternalName eq 'SOME_ATTRIBUTE' and d/DisplayValue eq true)
Response:
{
"error": {
"code": null,
"message": "The types 'Edm.String' and 'Edm.Boolean' are not compatible."
}
}
However, the attribute's type clearly is a boolean, so this last request should work according to the OData specification.
2) One of our requirements is to filter by numerical values, which cannot be done at all:
Request:
/Windchill/servlet/odata/v3/ClfStructure/ClfNodes('NODE_NAME')/ClassifiedObjects?$filter=ClassificationAttributes/any(d:(d/InternalName eq 'SOME_ATTRIBUTE' and d/DisplayValue ge 61.5))
Response:
{
"error": {
"code": null,
"message": "The types 'Edm.String' and 'Edm.Decimal' are not compatible."
}
}
Casting the (required) string value to a double will also produce an error:
Request:
/Windchill/servlet/odata/v3/ClfStructure/ClfNodes('NODE_NAME')/ClassifiedObjects?$filter=ClassificationAttributes/any(d:(d/InternalName eq 'SOME_ATTRIBUTE' and (Edm.Double)d/DisplayValue ge cast('61.5', Edm.Double))
Response:
{
"error": {
"code": null,
"message": "The types 'Edm.Double' and '[Boolean]' are not compatible."
}
}
The reason (IMO) might be that these nodes have some kind of internal data type that combines both values and their unit (e.g. "mm").
Could anyone please point me in the right direction as how to apply proper numerical / boolean filters for the classification search? I'd be very much obliged.
Best regards
After my own research, unfortunately classification search is not really properly implemented. There are a lot of small gritty details that don't work via WRS in the classification domain.
One solution could be to manually extend the WRS Domain and customize the needed functionality on Windchill side.
Thank you for taking the time to look into this. We received an upgrade to the (latest?) OData interface (v2.5) version, perhaps that will resolve the issues (tests still pending).
However, I am not getting my hopes up for this. I will inform you here about the outcome as soon as I know.
So to follow up on my own research: the problem remains even with v2.5 of the OData interface:
- no way to use numerical searches and filter by ">" or ">=", "<", etc.
- no way to use booleans
So the question is for PTC: Will this ever get implemented properly?? And if so, when?