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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

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

Janaki.Raman
6-Contributor

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
14-Alexandrite
14-Alexandrite
(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.

Top Tags