Solved

Filtering Journal Transactions by Detail Branch ID

  • 24 April 2023
  • 3 replies
  • 172 views

Userlevel 1
Badge

I am calling the JournalTransaction endpoint and expanding Details (as shown below).

{{BaseURL}}entity/Default/22.200.001/JournalTransaction?$expand=Details

I would like to apply the $filter param to the field Details/BranchID. In other words, I would like to return all the Detail lines that have a certain BranchID.

  1. A simple filter query:
    $filter=Details/BranchID eq 'SOFT'

    This returns the error “The parent value for a property access of a property 'BranchID' is not a single value. Property access can only be applied to a single value.”
    This is likely because Details to BranchID is a one-to-many relationship.

  2. I have looked into other syntaxes and found that you can use Lambda Operators:
    $filter=Details/any(d: d/BranchID eq 'SOFT')

    This returns the error “The method or operation is not implemented.”

  3. Another option is passing the $filter directly in the $expand parameter (also shown in the OData v3 Documentation):

    $expand=Details($filter=BranchID eq 'SOFT')

    This returns the error "Term 'Details($filter=BranchID eq 'SOFT')' is not valid in a $select or $expand expression."

The Lambda Operator seems like it is the most applicable for this use case but I cannot get it to work. I’m not sure if this method is supported by Acumatica or not, but it is present in OData v3.

 

Please let me know if anyone else has tried to achieve something similar and how to go about doing so.

icon

Best answer by Dmitrii Naumov 25 April 2023, 16:39

View original

3 replies

Userlevel 7
Badge +5

Hi @Jonah 

in REST API  filtering by details is not supported. 

 

You can try 

{{BaseURL}}/ODatav4/GLTran?$filter=BranchID eq 'SOFT'

Userlevel 1
Badge

You can try 

{{BaseURL}}/ODatav4/GLTran?$filter=BranchID eq 'SOFT'

Hi @Dmitrii Naumov 

I have tried this but receive a 404 error. Please advise if I am doing something wrong.

Userlevel 7
Badge +5

@Jonah if you have multitenant site you should have the following URL structure:

{{BaseURL}}/ODatav4/{{TenantName}}/GLTran?$filter=BranchID eq 'SOFT'

 

See the following help link for additional details:

https://help.acumatica.com/(W(3))/Help?ScreenId=ShowWiki&pageid=642945d9-df36-429b-8784-0f1bcf0e5495

 

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved