I want to change the sort order when printing checks from RefNbr to Vendor AcctCD.
In my override, I am adding one additional line to the select statement. If I use the original code, it works normally. If I use my code which only adds this line to the statement: OrderBy<Asc<Vendor.acctCD», the process screen “resets” after you select the payment method “Check”.
public class APPrintChecks_Extension : PXGraphExtension<PX.Objects.AP.APPrintChecks>
{
[PXOverride]
public virtual IEnumerable GetAPPaymentList()
{
//Original
//var cmd = new PXSelectJoin<APPayment,
// InnerJoinSingleTable<Vendor, On<Vendor.bAccountID, Equal<APPayment.vendorID>>,
// InnerJoin<PaymentMethod, On<PaymentMethod.paymentMethodID, Equal<APPayment.paymentMethodID>>,
// LeftJoin<CABatchDetail, On<CABatchDetail.origModule, Equal<BatchModule.moduleAP>,
// And<CABatchDetail.origDocType, Equal<APPayment.docType>,
// And<CABatchDetail.origRefNbr, Equal<APPayment.refNbr>>>>>>>,
// Where2<Where<APPayment.status, Equal<APDocStatus.pendingPrint>,
// And<CABatchDetail.batchNbr, IsNull,
// And<APPayment.cashAccountID, Equal<Current<PrintChecksFilter.payAccountID>>,
// And<APPayment.paymentMethodID, Equal<Current<PrintChecksFilter.payTypeID>>,
// And<Match<Vendor, Current<AccessInfo.userName>>>>>>>,
// And<APPayment.docType, In3<APDocType.check, APDocType.prepayment, APDocType.quickCheck>>>>(Base);
//Modified
var cmd = new PXSelectJoin<APPayment,
InnerJoinSingleTable<Vendor, On<Vendor.bAccountID, Equal<APPayment.vendorID>>,
InnerJoin<PaymentMethod, On<PaymentMethod.paymentMethodID, Equal<APPayment.paymentMethodID>>,
LeftJoin<CABatchDetail, On<CABatchDetail.origModule, Equal<BatchModule.moduleAP>,
And<CABatchDetail.origDocType, Equal<APPayment.docType>,
And<CABatchDetail.origRefNbr, Equal<APPayment.refNbr>>>>>>>,
Where2<Where<APPayment.status, Equal<APDocStatus.pendingPrint>,
And<CABatchDetail.batchNbr, IsNull,
And<APPayment.cashAccountID, Equal<Current<PrintChecksFilter.payAccountID>>,
And<APPayment.paymentMethodID, Equal<Current<PrintChecksFilter.payTypeID>>,
And<Match<Vendor, Current<AccessInfo.userName>>>>>>>,
And<APPayment.docType, In3<APDocType.check, APDocType.prepayment, APDocType.quickCheck>>>,
OrderBy<Asc<Vendor.acctCD>>>(Base);
foreach (PXResult<APPayment, Vendor, PaymentMethod, CABatchDetail> doc in cmd.SelectWithViewContext())
{
yield return new PXResult<APPayment, Vendor>(PXCache<APPayment>.CreateCopy(doc), doc);
}
}
Why would adding an OrderBy statement cause this select statement to fail?