Solved

Processing Screen not firing my delegate on a non-characteristic implementation

  • 6 July 2022
  • 7 replies
  • 70 views

Userlevel 4

 I have a processing screen to get data from an Acumatica table and do gyrations and put data into a custom table.  I don’t need to select any records from a filter results.  I just want to use the filters on the screen to “do the work” on all records returned by the filter.

I originally had a button under the End Date that would fire a custom action.  In order to make this a schedulable process, I THINK I needed to do it as a processing screen.

So...I tried to re-do the screen.

Since I am pulling data from the AuditHistory table, there is no “Select checkbox” to select on the processing screen.  

Is my delegate not firing because there is no Select checkbox available in the filter results?

Is there a way to use a PXFilterProcessing without a list of records with a Select checkbox?

This is what my screen looks like after removing the Get Report Data button and making it a processall button on the top of the screen.

This is the constructor that sets up the processing button.

public QTCAuditReport()
{
_currentUser = CommonServiceLocator.ServiceLocator.Current.GetInstance<ICurrentUserInformationProvider>().GetUserId();
            RecordsToProcess.SetProcessVisible(false);
            RecordsToProcess.SetProcessAllVisible(true);
            RecordsToProcess.SetProcessAllCaption("Get Report Data");
            RecordsToProcess.SetProcessDelegate(GetReportData);
}

This is my filter selector.

        public PXFilteredProcessing<AuditHistory, QTCAuditHistoryReportFilter, 
            Where<AuditHistory.screenID.IsEqual<QTCAuditHistoryReportFilter.screenID.FromCurrent>.
                And<AuditHistory.changeDate.IsBetween<QTCAuditHistoryReportFilter.startDate.FromCurrent, QTCAuditHistoryReportFilter.endDate.FromCurrent>>>> RecordsToProcess;
 

When I fill in the filter fields, I do get data from the AuditHistory table.  Strangely, it only shows 1 column.

Since I really don’t care what is being displayed, I don’t think this matters for me.

This is the delegate that should be fired when you click the process button

        private void GetNewDataset(List<AuditHistory> entriesToProcess)
        {

            PXLongOperation.StartOperation(this, delegate ()
            {

                IsProcessing = true;
ETC.

I am aware that the delegate SHOULD be private static void in order for this to run asynchronously.  Since this will be a scheduled operation running behind the scenes, I don’t care of it runs synchronously.  My delegate needs to be aware of the filter values on the graph because it does special stuff depending on the values.  I delete existing data from my custom table based on the date range and table name so I don’t add duplicate records.  

Is there some “hack” that I can do to simply fire a method without having to have a Select checkbox in a grid?  I don’t even need to see the data returned by the filter.

icon

Best answer by Naveen Boga 6 July 2022, 20:05

View original

7 replies

Userlevel 4
Badge

Hi @joe21 

 

I have a similar processing screen. What I did was having auto-selected by default and not visible:

        #region Selected
[PXBool]
[PXUnboundDefault(true)]
[PXUIField(DisplayName = "Selected", Visible = false)]
public virtual bool? Selected { get; set; }
public abstract class selected : PX.Data.BQL.BqlBool.Field<selected> { }
#endregion

And yes. It matters if it’s static or nor. Please make the delegate GetReportData static to avoid any Acumatica misbehavior.

The setup in the constructor is correct.

Userlevel 4

Hi @Leonardo Justiniano ,

How do I get the select checkbox to be returned as part of the filter results?  In Acumatica training, we added the checkbox to the custom DAC.  Since I’m pulling from an Acumatica table, there is no Select checkbox.

Userlevel 4
Badge

Hi @joe21 

 

You can do it creating a projection DAC or a SQL View DAC.

Userlevel 7
Badge +12

Hi @joe21  I’m assuming that this issue is also solved from the below response.

Please let me know if you have any queries?

 

Userlevel 4

Hi @Naveen Boga 

I’m not able to get my processing delegate to fire.  I think it is because there is no Selected boolean (checkbox) in the filter results.  That’s just a guess.  I looked at the acumatica training code to see if I could figure out how to do a projection as @Leonardo Justiniano  suggested.  I am too dumb to figure that option out.  The only thing I can thing to try next is the suggestion from Leonardo to do a SQL View that includes a boolean for the checkbox as part of the result set.

 

Userlevel 7
Badge +12

@joe21  Have you tried by extending the Audit History DAC with Selected field like below and verified?

Add this field to the Processing screen .aspx page at the grid level.

 

 public class AuditHistoryExt : PXCacheExtension<AuditHistory>
{
#region Selected
public abstract class selected : IBqlField
{
}
protected bool? _Selected = false;
[PXBool()]
[PXDefault(false, PersistingCheck = PXPersistingCheck.Nothing)]
[PXUIField(DisplayName = "Selected")]
public virtual bool? Selected
{
get
{
return _Selected;
}
set
{
_Selected = value;
}
}
#endregion
}

 

Userlevel 5
Badge +1

@joe21  Projections are pretty simple if you know how to create them. Below link help you to understand the projections. 

https://asiablog.acumatica.com/2018/03/pxprojection-sql-views-using-bql.html 

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