Solved

FilteredBy breaks ProcessingView

  • 14 April 2023
  • 6 replies
  • 91 views

Badge +11

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?

icon

Best answer by slesin 19 April 2023, 20:31

View original

6 replies

Userlevel 7
Badge +5

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

 

Userlevel 7
Badge +8

@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;
}

 

Badge +11

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.

Userlevel 7
Badge +8

@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.

Userlevel 2
Badge

@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.

 

Badge +11

@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!

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