Skip to Content
0

SAP Business One - Service Layer - Nested filtering

Jan 25 at 09:04 AM

102

avatar image

How can I do nested filtering in SAP Business One Service Layer?

I tried with:

https://hanab12:50000/b1s/v1EmployeesInfo?$select=EmployeeID,FirstName,LastName,EmployeeAbsenceInfoLines&$filter=(EmployeeAbsenceInfoLines/FromDate eq '2018-01-25')

But it just gives me back an error: "Property 'EmployeeAbsenceInfoLines/FromDate' of 'EmployeeInfo'is invalid" but the property names are correct based on the Employee object.

Another example would be to only get Sales Order where a specific items has been used on line level.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Ralph Oliveira
Feb 07 at 01:13 PM
0

Sorry for locking your thread ealier, my bad.

here is a workaround to apply $filter on child elements:

First join to the Objects – Orders, Doc Lines of the Order, and apply $Filter conditions: (DocLines.DocEntry = Doc.DocEntry ) AND (DocLines.ItemCode eq with 'A00001'). I don't have Employee's data on my system, but should work for you case as well.

https://<SERVICELAYER>:50000/b1s/v1/$crossjoin(Orders,Orders/DocumentLines)?$expand=Orders($select=DocEntry, DocNum),Orders/DocumentLines($select=ItemCode,LineNum)&$filter=Orders/DocEntry eq Orders/DocumentLines/DocEntry and Orders/DocumentLines/ItemCode eq 'A00001'
Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

This workaround is working for me.

https://<SERVICELAYER>:50000/b1s/v1/$crossjoin(PickLists,PickLists/PickListsLines)?$expand=PickLists($select=Absoluteentry, ObjectType),PickLists/PickListsLines($select=PickStatus,LineNumber)&$filter=PickLists/Absoluteentry eq PickLists/PickListsLines/AbsoluteEntry and PickLists/PickListsLines/PickStatus eq 'R'<br>

But when i want to select a UDF it say's:

"invalid property 'U_Wagennummer' of type 'PickListsLine'"

https://<SERVICELAYER>:50000/b1s/v1/$crossjoin(PickLists,PickLists/PickListsLines)?$expand=PickLists($select=Absoluteentry, ObjectType),PickLists/PickListsLines($select=PickStatus,LineNumber)&$filter=PickLists/Absoluteentry eq PickLists/PickListsLines/AbsoluteEntry and PickLists/PickListsLines/U_Wagennummer eq 'W1'<br>

is there also a workaround for UDF's or does it still not work for now?

Thank you

0

Hello,

is this still the only Workaround or is there now another way to filter on child Elements?

Thank you

0