Skip to main content
Solved

Connection between PMTran and APTran


aaghaei
Captain II
Forum|alt.badge.img+9

Hello Community,

 

I need to Join PMTran and APTran. My understanding is the below join should work but when I compare some of the transactions which are generated from AP, their LineNbr doesn’t agree to OrigLineNbr in PMTran. Below is the query I need, which is a simple one but not sure why LineNbr field doesn’t align. 

                var tran = SelectFrom<PMTran>
                    .LeftJoin<APTran>
                        .On<PMTran.origTranType.IsEqual<APTran.tranType>
                        .And<PMTran.origRefNbr.IsEqual<APTran.refNbr>>
                        .And<PMTran.origLineNbr.IsEqual<APTran.lineNbr>>
                        .And<PMTran.origModule.IsEqual<BatchModule.moduleAP>>>
                    .View.Select(Base);

If this is not the right join, then what is it?

Best answer by aaghaei

UPDATE:

I ended up with the below query and so far it has passed all my tests.

PXResultset<PMTran> actual = SelectFrom<PMTran>
    .InnerJoin<GLTran>
        .On<PMTran.tranID.IsEqual<GLTran.pMTranID>
        .And<GLTran.module.IsEqual<BatchModule.moduleAP>>>
    .LeftJoin<APTran>
        .On<GLTran.tranType.IsEqual<APTran.tranType>
        .And<GLTran.refNbr.IsEqual<APTran.refNbr>>
        .And<GLTran.tranLineNbr.IsEqual<APTran.lineNbr>>>
    .View.Select(Base);

 

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

6 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3381 replies
  • April 24, 2023

Hi @aaghaei  I did not check but may work, can you check this please?

 


				var Details = new PXSelectJoin<PMTran,
					InnerJoin<ARTran, On<ARTran.tranType, Equal<PMTran.aRTranType>,
					And<ARTran.refNbr, Equal<PMTran.aRRefNbr>,
					And<ARTran.lineNbr, Equal<PMTran.refLineNbr>>>>>,
					Where<PMTran.aRTranType, Equal<Required<PMTran.aRTranType>>,
					And<PMTran.aRRefNbr, Equal<Required<PMTran.aRRefNbr>>>>,
					OrderBy<Asc<ARTran.lineNbr>>>(Base);

 


aaghaei
Captain II
Forum|alt.badge.img+9
  • Author
  • Captain II
  • 1178 replies
  • April 24, 2023

Thank you @Naveen Boga 

the code you provided joins the AR but I need to join APTran to PMTran. The join you provided links the invoices which are generated from PMProforma Invoices to PMTran


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3381 replies
  • April 24, 2023

Oops...Sorry,@aaghaei  I thought it was for ARTran. 

Let me check for APTran and let you know If I found anything.


aaghaei
Captain II
Forum|alt.badge.img+9
  • Author
  • Captain II
  • 1178 replies
  • April 24, 2023

Thanks @Naveen Boga Appreciate your time pal


aaghaei
Captain II
Forum|alt.badge.img+9
  • Author
  • Captain II
  • 1178 replies
  • Answer
  • April 24, 2023

UPDATE:

I ended up with the below query and so far it has passed all my tests.

PXResultset<PMTran> actual = SelectFrom<PMTran>
    .InnerJoin<GLTran>
        .On<PMTran.tranID.IsEqual<GLTran.pMTranID>
        .And<GLTran.module.IsEqual<BatchModule.moduleAP>>>
    .LeftJoin<APTran>
        .On<GLTran.tranType.IsEqual<APTran.tranType>
        .And<GLTran.refNbr.IsEqual<APTran.refNbr>>
        .And<GLTran.tranLineNbr.IsEqual<APTran.lineNbr>>>
    .View.Select(Base);

 


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2640 replies
  • April 25, 2023

Thank you for sharing your solution with the community @aaghaei !


Reply


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