Data View Delegates: Customization of a Data View
The platform provides a way to alter or extend the data views defined in a graph.
Suppose that you have declared the Objects data view within the base graph, as shown below.
public class BaseGraph : PXGraph<BaseGraph, DAC>
{
public PXSelect<DAC> Objects;
}
You can alter a data view within a graph extension in the following ways.
By Altering the Data View Within a Graph Extension
A data view that is redeclared within a graph extension replaces the base data view in the Views collection of the graph instance. Consider the following example of a first-level graph extension.
public class BaseGraphExt : PXGraphExtension<BaseGraph>
{
public PXSelectOrderBy<DAC,
OrderBy<Asc<DAC.field>>> Objects;
}
The Views collection of a graph instance contains the PXView object, which uses the Objects data view declared within the first-level extension, instead of the data view declared within the base graph.
By Declaring or Altering the Data View Delegate in a Graph Extension
The new delegate is attached to the corresponding data view. Consider the following example of a second-level graph extension.
public class BaseGraphExtOnExt : PXGraphExtension<BaseGraphExt, BaseGraph>
{
protected IEnumerable objects()
{
return PXSelect<DAC>.Select(Base);
}
}
The Views collection of a graph instance contains the PXView object, which uses the Objects data view declared within the first-level extension, with the objects() delegate declared within the second-level extension (see the diagram below).

public class BaseGraphExtOnExt : PXGraphExtension<BaseGraphExt, BaseGraph>
{
protected IEnumerable objects()
{
return Base.Objects.Select();
}
}The new delegate queries the data view declared within the base graph. Having redeclared the data view within the first-level extension, you prevent the data view execution from an infinite loop (see the following diagram).


