Here’s an example of a data view and data view delegate. For complex filtering conditions, it can be helpful to use a data view delegate to simplify the logic a bit. This is optional. It can be written into the data view as well. This is also written in F-BQL.
[PXFilterable]
public SelectFrom<DAC>.
LeftJoin<OtherDAC>.
On<DAC.FK.Something>.
OrderBy<DAC.date.Asc>.
ProcessingView.FilteredBy<Filter> Lines;
protected virtual IEnumerable lines()
{
var select = new SelectFrom<DAC>.
LeftJoin<OtherDAC>.
On<DAC.FK.Something>.
OrderBy<DAC.date.Asc>.
View(this);
select.WhereAnd<Where<DAC.fieldOne.StartsWith<example>>>();
var filter = Filter.Current;
if (filter is object)
{
if (filter.Date.HasValue)
select.WhereAnd<Where<DAC.date.IsGreaterEqual<Filter.startDateTime.FromCurrent>>>();
if (filter.EndDateTime.HasValue)
select.WhereAnd<Where<DAC.date.IsLessEqual<Filter.endDateTime.FromCurrent>>>();
if (filter.Action == "D")
{
select.WhereAnd<Where<DAC.fieldTwo.IsEqual<True>>>();
}
}
if (filter.LimitResults ?? false)
return select.SelectWindowed(0, 200);
else
return select.Select();
}