Skip to main content
Answer

PXRedirectRequiredException at the end of processing on a processing screen

  • November 26, 2024
  • 2 replies
  • 148 views

Joe Schmucker
Captain II
Forum|alt.badge.img+3

I created a custom processing screen.  At the end of the processing, I want to create a results report.

       public static void DoIt(List<UploadFileRevision> lineList, RecordsToProcessFilter currentFilter, bool isMassProcess = false)
{

DO ALL MY PROCESSING HERE

At the very end:

if (results.GetRowCount() > 0)
{
throw new PXReportRequiredException(results, "IC604010", PXBaseRedirectException.WindowMode.NewWindow);
}

}

If I have the PXReportRequiredException, the processing screen does not show the processing popup.  It also does not refresh the grid of items that are available to be processed (remove the items that were processed).  The report opens in a new window and it looks great.

If I comment out the report redirect, the screen works perfectly.  

Is there a way to create my results report and not break the standard processing screen?  I don’t absolutely have to have the report, but it is a nice feature.

I am wondering if I can trigger the report to run after you click the button to close the processing output dialog.  However, at that point, I don’t know if the DAC storing my results will still be available.  The results DAC is not an actual table.

 

Best answer by Joe Schmucker

I’ve been testing by processing one row at a time.  Here’s what is happening.  If I process 200, everything shows just fine.  I think that the throw ex is happening too fast.  The report is thrown before the process can finish.  I was wondering why every once in while the processing dialog shows.  

I paused the thread for 5 seconds just before the report is created.  Just adding this pause seems to have fixed the issue.  Not happy that I wasted hours trying to figure out why my code was broken when it wasn’t.

            System.Threading.Thread.Sleep(5000);

            if (results.GetRowCount() > 0)
            {
                throw new PXReportRequiredException(results, "IC604010", PXBaseRedirectException.WindowMode.NewWindow);
            }

 

2 replies

darylbowman
Captain II
Forum|alt.badge.img+15

I don't know of any way to do this.

The only workaround I can think of is to try throwing the exception on the last record, but I'm not sure what that would do.


Joe Schmucker
Captain II
Forum|alt.badge.img+3
  • Author
  • Captain II
  • Answer
  • November 27, 2024

I’ve been testing by processing one row at a time.  Here’s what is happening.  If I process 200, everything shows just fine.  I think that the throw ex is happening too fast.  The report is thrown before the process can finish.  I was wondering why every once in while the processing dialog shows.  

I paused the thread for 5 seconds just before the report is created.  Just adding this pause seems to have fixed the issue.  Not happy that I wasted hours trying to figure out why my code was broken when it wasn’t.

            System.Threading.Thread.Sleep(5000);

            if (results.GetRowCount() > 0)
            {
                throw new PXReportRequiredException(results, "IC604010", PXBaseRedirectException.WindowMode.NewWindow);
            }