Question

How to pass joined tables into static process delegate

  • 26 May 2021
  • 1 reply
  • 16 views

Similar to this topic:

I have a working processing UI that I want to use to create individual PDFs (from a report) and save to disk.  At the end of the process I want to show the same report (all together) in preview with the same records used to create the individual PDFs.  I have a working report but am struggling with how to get the joined tables in my PXReportResultSet since my delegate only gets the main table passed in as List.

I’m sure I could BQL query these somehow or run a full BQL query again by passing in the filter (based on the referenced technique) but not sure if there is a better way to just grab these from the results already retrieved for the UI.

 

Here is my code:

        public APStaleDateLettersProcess()
{
DetailsView.SetSelected<APQuickCheck.selected>();
DetailsView.SetProcessDelegate(Process);
}

public PXCancel<APStaleDatedCheckFilter> Cancel;
public PXFilter<APStaleDatedCheckFilter> Filter;

public PXFilteredProcessingJoin<APQuickCheck, APStaleDatedCheckFilter,
InnerJoin<APContact, On<APContact.contactID, Equal<APQuickCheck.remitContactID>>,
InnerJoin<APAddress, On<APAddress.addressID, Equal<APQuickCheck.remitAddressID>>>>,
Where<APRegisterExt.usrStaleDatedOn, Between<Current<APStaleDatedCheckFilter.startDate>, Current<APStaleDatedCheckFilter.endDate>>,
And<Where<APQuickCheck.released, Equal<True>,
And<APQuickCheck.status, Equal<APDocStatus.closed>,
And<Where<APQuickCheck.docType, Equal<APDocType.quickCheck>,
And<APRegisterExt.usrStaleDated, Equal<True>>>>>>>>> DetailsView;


public static void Process(List<APQuickCheck> payments)
{
// the result set to run the report on
PXReportResultset quickChecks =
new PXReportResultset(typeof(APQuickCheck), typeof(APContact), typeof(APAddress));

foreach (APQuickCheck quickCheck in payments)
{
// create individual PDF files

// just get each object individually using keys from quickCheck??
// APContact contact = PXSelect<APContact, Where<APContact.contactID, Equal<quickCheck.remitContactID>>>.Select();

// How to get data from joined tables when all I have is APQuickCheck??????
PXResult<APQuickCheck, APContact, APAddress> result = new PXResult<APQuickCheck, APContact, APAddress>(quickCheck, new APContact(), new APAddress());
quickChecks.Add(result);
}
if (quickChecks.GetRowCount() > 0)
{
throw new PXReportRequiredException(quickChecks, "AP670000", PXBaseRedirectException.WindowMode.NewWindow, "Stale Dated Letters");
}
}

 


1 reply

I wound up creating a public method on a graph instance that I call from my static delegate so I could use the @P.AsString using refNbr of quickCheck to get a PXResult for each row with all the tables joined in that BQL.  Works well so far.  Just could not see a way to do any type of dynamic BQL without being in an graph instance method.

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 — 2020  Acumatica, Inc. All rights reserved