Skip to main content
Solved

How to pass joined tables into static process delegate

  • 26 May 2021
  • 1 reply
  • 364 views

Forum|alt.badge.img+1

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

 

Best answer by rjean09

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.

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

1 reply

Forum|alt.badge.img+1
  • Author
  • Semi-Pro III
  • 76 replies
  • Answer
  • May 27, 2021

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


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