Skip to main content
Solved

OData4 - Inventory Items. Expand Attributes

  • December 8, 2022
  • 1 reply
  • 474 views

Forum|alt.badge.img

I am trying to port some of my calls over from using the Rest API to using the ODATA4 interface. Using a simple call like this…

 

http://ODATAV4_URL/PX_Objects_In_InventoryItem?$filter=InventoryCD eq 'BCWICFGBLK’&$format=json

 

How to include a list of all the attributes and values associated to a InventoryItem. With the RestAPI, I could just $expand=Attributes and it would return that in the payload. I can’t seem to figure it out when using ODATA.

 

Thank you all!

 

Eric

Best answer by Leonardo Justiniano

Hi @eelliston 

You might need to retrieve the NoteID for the specific InventoryItem and then query CSAnswers for existing assigned values.

URL/PX_Objects_Cs_CSAnswers?$skip=0&$top=10&$filter=RefNoteID eq '...'

$expand works on ID columns when the navigation properties are set. For example:

URL/?$expand=<Table>By<Field>

It depends on the foreign keys of the table defined at DAC level

 

You can expand for example Item Class tied to the Item like:

URL/InventoryItem?$filter=InventoryCD eq '...'&$expand=INItemClassByItemClassID

The result comes as

 

Attributes has no foreign key defined.

 

Otherwise use RESTAPI Get call to retrieve all those details in one call. 

 

Hope this helps.

 

View original
Did this topic help you find an answer to your question?

1 reply

Leonardo Justiniano
Jr Varsity II
Forum|alt.badge.img+4

Hi @eelliston 

You might need to retrieve the NoteID for the specific InventoryItem and then query CSAnswers for existing assigned values.

URL/PX_Objects_Cs_CSAnswers?$skip=0&$top=10&$filter=RefNoteID eq '...'

$expand works on ID columns when the navigation properties are set. For example:

URL/?$expand=<Table>By<Field>

It depends on the foreign keys of the table defined at DAC level

 

You can expand for example Item Class tied to the Item like:

URL/InventoryItem?$filter=InventoryCD eq '...'&$expand=INItemClassByItemClassID

The result comes as

 

Attributes has no foreign key defined.

 

Otherwise use RESTAPI Get call to retrieve all those details in one call. 

 

Hope this helps.

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings