Skip to main content
11-Garnet
May 23, 2023
Question

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

  • May 23, 2023
  • 2 replies
  • 1611 views

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

17-Peridot
June 1, 2023

@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

15-Moonstone
July 18, 2023

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.