Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Translate the entire conversation x

ODATA $select filter: How to select part attribute that is not available for all the parts

Janaki.Raman
8-Gravel

ODATA $select filter: How to select part attribute that is not available for all the parts

Hi,

 

Am using an Odata service with some filters, I use $select to select specific part properties among all.

 

Lets say am querying a part detail in that, "GeneralStatus" is the property am looking for, but this particular property is not available in some of its child parts. Because of the am getting error for API call.

 

{
    "error": {
        "code": null,
        "message": "The property 'GeneralStatus', used in a query expression, is not defined in type 'Part'."
    }
}

Question is, is there a way to skip the selection if property not available? so then we can avoid error coming from nth child?

like, $select=GeneralStatus(if available),Name,Number

 

thanks,
Jankiraman

2 REPLIES 2

@Janaki.Raman , I am not experienced with this but can you add a condition to your selection where the "GeneralStatus" != ""

 

What you are doing is trying to exclude the rows from the table which don't have the value, Aa a result you avoid the issue.
Just a guess

 

pehowe

KSM
15-Moonstone
15-Moonstone
(To:Janaki.Raman)

Hi,

If some child parts is not having General Status, then its better to fetch all the data first and then extract what ever you want.

Announcements
Top Tags