Skip to main content

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?

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);

 


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


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

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


Thanks @Naveen Boga Appreciate your time pal


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);

 


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


Reply