Xafari Reports. Context Reports
Report Parameters can be set in the context of a specific business object. This use case is demonstrated in End-User Capabilities topic.
Specify the context type in the Report Parameters using Xafari.ContextPropertyAttribute. The attribute exposes TypeMatchMode, ObjectsCriteria and ObjectsCriteriaMode properties that defines the strategy to bind Report and context object. The following code snippet demonstrates how to specify that the Category object will be the context parameter:
- c#
- VB
namespace Xafari.Northwind.DC.Reports.Product
{
[XafDisplayName("Parameters of report 'Products'")]
[ImageName("BO_Product")]
[DomainComponent]
public interface ProductParameters : XafariReportParametersBase
{
[ContextProperty(ObjectsCriteria = "Name!='CategoryCondiments'")]
IList<Category> Categories { get; }
}
}
Namespace Xafari.Northwind.DC.Reports.Product
<XafDisplayName("Parameters of report 'Products'")> _
<ImageName("BO_Product")> _
<DomainComponent> _
Public Interface ProductParameters
Inherits XafariReportParametersBase
<ContextProperty(ObjectsCriteria := "Name!='CategoryCondiments'")> _
ReadOnly Property Categories As IList(Of Category)
End Interface
End Namespace
It is important that the Categories is a public property and available for recording.