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