Question

How do create a relation that will join only one of several rows?

  • 22 September 2022
  • 2 replies
  • 158 views

Userlevel 3
Badge

I want to join ARInvoice to FSBillHistory.  Sometimes I get two returns for one ARInvoice RefNbr, depending on if there are two appointments billed to the one invoice.

There must be a way to use relations to grab only one of the two (or possibly more than two) returns.

I have tried using First([X]) = [X] , Max([X]) = ([X]) (can’t because of aggregate).  There must be a way to relate the join to provide only one return per match.  Can anyone help??

 

-David

 

 


2 replies

Userlevel 6
Badge +4

Hi @dgross 
Have you tried using Grouping? you can group by ARInvoice.RefNbr

 

Userlevel 7
Badge +4

Hi @dgross ! As @Anacarina Calvo  mentioned grouping can be a good option unless you are trying to show an amount of only one of the lines to be returned.

Otherwise what you’ll need to do is join a second time the FSBillHistory table (giving it a new alias) and probably do a join to the original FSBillHistory table where the CreatedDateTime is < or > than the other CreatedDateTime.

Here is a recent post where we accomplished something similar but relating to Sales Orders and Shipments with the need being to show the first shipment on the order:

 

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