Skip to main content
Answer

FilteredBy breaks ProcessingView

  • April 14, 2023
  • 6 replies
  • 144 views

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

I’m starting to get really frustrated with processing screens lately, but maybe I’m just bad at making them.

 

The latest frustration is that when I use ProcessingView Lines, the screen looks like a processing screen:

 

But when I use  ProcessingView.FilteredBy<PODDocumentsFilter> Lines, all the processing tools  go away: 

I have defined the data view like this:

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

[PXFilterable]
public SelectFrom<SOPackageDetailEx>.
InnerJoin<SOShipment>.
On<SOPackageDetailEx.FK.Shipment>.
LeftJoin<ISSOShipmentTrackingPOD>.
On<ISSOShipmentTrackingPOD.FK.PackageDetail>.
Where<
SOPackageDetailEx.customRefNbr1.StartsWith<fedEx>.
And<
Brackets<
PODDocumentsFilter.action.FromCurrent.IsEqual<actionDownload>.
And<ISSOPackageDetailExExt.usrIsPODDownloaded.IsEqual<False>.
Or<ISSOPackageDetailExExt.usrIsPODDownloaded.IsNull>>.
Or<PODDocumentsFilter.showDownloaded.FromCurrent.IsEqual<True>.
And<ISSOPackageDetailExExt.usrIsPODDownloaded.IsEqual<True>>>
>.
Or<PODDocumentsFilter.action.FromCurrent.IsEqual<actionExport>.
And<ISSOPackageDetailExExt.usrIsPODDownloaded.IsEqual<True>.
And<ISSOPackageDetailExExt.usrIsPODExported.IsEqual<False>.
Or<ISSOPackageDetailExExt.usrIsPODExported.IsNull>>.
Or<PODDocumentsFilter.showExported.FromCurrent.IsEqual<True>.
And<ISSOPackageDetailExExt.usrIsPODExported.IsEqual<True>>>>>
>.
And<SOShipment.shipDate.IsGreaterEqual<PODDocumentsFilter.startDateTime.FromCurrent>>.
And<SOShipment.shipDate.IsLessEqual<PODDocumentsFilter.endDateTime.FromCurrent>.Or<PODDocumentsFilter.endDateTime.FromCurrent.IsNull>>.
And<SOShipment.customerID.IsEqual<PODDocumentsFilter.customerID.FromCurrent>.Or<PODDocumentsFilter.customerID.FromCurrent.IsNull>>>.
ProcessingView.FilteredBy<PODDocumentsFilter> Lines;

The filter is defined like this:

[PXHidden]
public class PODDocumentsFilter : IBqlTable
{
#region Action
[PXDBString(1, IsFixed = true)]
[PXUIField(DisplayName = "Action")]
[PXStringList(
new string[] { "D", "E" },
new string[] { "Download FedEx POD", "Export FedEx POD" })]
[PXDefault("D")]
public virtual string Action { get; set; }
public abstract class action : PX.Data.BQL.BqlString.Field<action> { }
#endregion

#region StartDateTime
[PXDBDate()]
[CurrentDateDefault(-7)]
[PXUIField(DisplayName = "Start Date", Required = true)]
public virtual DateTime? StartDateTime { get; set; }
public abstract class startDateTime : PX.Data.BQL.BqlDateTime.Field<startDateTime> { }
#endregion

#region EndDateTime
[PXDBDate()]
[PXUIField(DisplayName = "End Date")]
public virtual DateTime? EndDateTime { get; set; }
public abstract class endDateTime : PX.Data.BQL.BqlDateTime.Field<endDateTime> { }
#endregion

#region CustomerID
[PXUIField(DisplayName = "Customer")]
[CustomerActive]
public virtual int? CustomerID { get; set; }
public abstract class customerID : PX.Data.BQL.BqlInt.Field<customerID> { }
#endregion

#region ShowDownloaded
[PXDBBool]
[PXUIVisible(typeof(Where<action.IsEqual<actionDownload>>))]
[PXUIField(DisplayName = "Show Downloaded")]
[PXDefault(false)]
public bool? ShowDownloaded { get; set; }
public abstract class showDownloaded : PX.Data.BQL.BqlBool.Field<showDownloaded> { }
#endregion

#region ShowExported
[PXDBBool]
[PXUIVisible(typeof(Where<action.IsEqual<actionExport>>))]
[PXUIField(DisplayName = "Show Exported")]
[PXDefault(false)]
public bool? ShowExported { get; set; }
public abstract class showExported : PX.Data.BQL.BqlBool.Field<showExported> { }
#endregion

#region LimitResults
[PXDBBool]
[PXUIField(DisplayName = "Limit Results")]
[PXDefault(true)]
public bool? LimitResults { get; set; }
public abstract class limitResults : PX.Data.BQL.BqlBool.Field<limitResults> { }
#endregion
}

 

What am I doing wrong?

Best answer by slesin

@darylbowman

In the aspx page, try changing the PrimaryView parameter from “Lines” to “Filter”.

ProcessingView and ProcessingView.FilteredBy differ in which DAC they generate toolbar actions for. Same is true for their traditional BQL versions.

 

6 replies

Forum|alt.badge.img+7
  • Captain II
  • April 14, 2023

I think you want your filter fields to not be PXDB but just PX.

 


aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • April 14, 2023

@darylbowman 

Instead of “ProcessingView.FilteredBy<PODDocumentsFilter> Lines” use PXFilteredProcessing<DAC, FilterDAC, YourCondtition> Lines”.

If your public view is complicated then declare a simple public view and write a view delegate. Here is an example of a complex Processing screen I did a few weeks ago.

// The Public View
public PXFilter<HCLSMFileFilter> Filter;

[PXFilterable]
public PXFilteredProcessing<UploadFile, HCLSMFileFilter, Where<UploadFile.fileID.IsNull>> Files;


// The View Delegate
public IEnumerable files()
{
HCLSMFileFilter filter = Filter.Current;
var uploadBegDate = filter.UploadBegDate.Value.Date;
var uploadEndDate = filter.UploadEndDate.Value.Date.AddDays(1);
var docBegDate = filter.DocBegDate.Value.Date;
var docEndDate = filter.DocEndDate.Value.Date.AddDays(1);

var excludedScreens = HCLSMMessages.ExcludedScreens.Split(';').ToList().Select(item => item.Trim()).ToArray<string>();

List<UploadFile> uploadFile = SelectFrom<UploadFile>
.Where<UploadFile.fileID.IsNull.And<UploadFile.primaryScreenID.IsNotIn<@P.AsString>>>
.View.Select(this, new[] { excludedScreens }).FirstTableItems.RowCast<UploadFile>().ToList();

PXDelegateResult delegateResult = new PXDelegateResult();
delegateResult.Clear();
delegateResult.AddRange(uploadFile);

// I do have more complex queries here to add to delegateResult

return delegateResult;
}

 


darylbowman
Captain II
Forum|alt.badge.img+15
  • Author
  • April 15, 2023

I understand this is possible, but if this works, does that mean it's a bug? I believe my way is F-BQL whereas yours is traditional BQL.


aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • April 15, 2023

@darylbowman 

using View Delegate is irrelevant to Traditional or FBQL and my delegate code is also FBQL but if you mean the Processing View syntax/parameter itself, that I  do not know if it’s a bug as you say or not.


slesin
Acumatica Employee
Forum|alt.badge.img
  • Acumatica Employee
  • Answer
  • April 19, 2023

@darylbowman

In the aspx page, try changing the PrimaryView parameter from “Lines” to “Filter”.

ProcessingView and ProcessingView.FilteredBy differ in which DAC they generate toolbar actions for. Same is true for their traditional BQL versions.

 


darylbowman
Captain II
Forum|alt.badge.img+15
  • Author
  • April 19, 2023

@slesin - You sir. I’d buy you a beer!

 

This fixed both my problems. The problem I didn’t mention I had, and the real reason I was trying to use the FilterBy<>, was because I wasn’t getting the ‘Filter Values’ tab on the automation schedule dialog.

I now get the processing actions AND the Filter Values tab.

 

Thank you again!