A report master is an OFBiz content which allows a user to generate data reports. It defines data connexion, and a general filtering form for data. It can be based on an entity, a dedicated service, or in a wider sense on any shape a data connexion can take and return back a map.
<form name="CTNT_MASTER_EXAMPLE" type="single" extends="AbstractFlexibleReportSearchForm">
<auto-fields-entity entity-name="Example" default-field-type="find"/>
</form> <DataResource dataResourceId="DR_MASTER_EXAMPLE" dataResourceTypeId="ELECTRONIC_TEXT" dataTemplateTypeId="FORM_COMBINED" />
<ElectronicText dataResourceId="DR_MASTER_EXAMPLE">
<textData><![CDATA[<!--default domain form-->
<form name="${masterContentId}_${contentId}" type="single" extends="${masterContentId}" extends- resource="component://birt/widget/birt/BirtMasterForms.xml">
</form>]]>
</textData>
</ElectronicText>
<Content contentId="CTNT_MASTER_EXAMPLE" contentTypeId="REPORT_MASTER" dataResourceId="DR_MASTER_EXAMPLE" statusId="CTNT_PUBLISHED" contentName="Example" description="Master Content for Example" />
<!-- Data retrieval will be done using perform find on entity Example-->
<ContentAttribute contentId="CTNT_MASTER_EXAMPLE" attrName="Entity" attrValue="Example"/>The form in the database is the form that will allow users to change form parameters. You can add any field you desire. Some field names are though reserved: reportContentId, overrideFilters, entityViewName, birtContentType.
<property key="Content.description.CTNT_MASTER_EXAMPLE">
<value xml:lang="en">Example</value>
<value xml:lang="fr">Exemple</value>
</property>Your Report Master is created ! You can now create reports using it.
Create in plugins/birt/src/org/ofbiz/birt/birt/BirtMasterReportServices.java 2 dedicated services (see examples there)
Map<String, Object> parameters = (Map<String, Object>) reportContext.getParameterValue("parameters");This Map will give access fields of the filtering form. This service will return a list called list of type List
<form name="CTNT_MASTER_TURNOVER" type="single" extends="AbstractFlexibleReportSearchForm">
<field name="fromDate"><date-time type="date"/></field>
<field name="thruDate"><date-time type="date"/></field>
<field name="productCategoryId"><lookup target-form-name="LookupProductCategory"/></field>
<field name="productStoreId"><lookup target-form-name="LookupProductStore"/></field>
</form> <CustomMethod customMethodId="CM_FB_TURNOVER" customMethodTypeId="FLEXIBLE_BIRT" customMethodName="flexibleReportTurnOver" description="service to resolve invoice for turnover report domain"/>
<DataResource dataResourceId="DR_MASTER_TURNOVER" dataResourceTypeId="ELECTRONIC_TEXT" dataTemplateTypeId="FORM_COMBINED" />
<ElectronicText dataResourceId="DR_MASTER_TURNOVER">
<textData><![CDATA[<!--default domain form-->
<form name="${masterContentId}_${contentId}" type="single" extends="${masterContentId}" extends-resource="component://birt/widget/birt/BirtMasterForms.xml">
</form>]]>
</textData>
</ElectronicText>
<Content contentId="CTNT_MASTER_TURNOVER" customMethodId="CM_FB_TURNOVER" contentTypeId="REPORT_MASTER" dataResourceId="DR_MASTER_TURNOVER" statusId="CTNT_PUBLISHED" contentName="Turnover" description="Master Content for TURNOVER domain" />
<!-- Data retrieval will be done using two service calls. First the contentAttribute Service gives the service that will define which data and label will be retrieved,
and which filter and label are supported by the report design (default value will call the second service with "prepareField" suffix).
Second, the custom method gives the service to retrieve all data in the report design.
Here : flexibleReportTurnOverPrepareFields (customMethodName + "prepareFields") then flexibleReportTurnOver-->
<ContentAttribute contentId="CTNT_MASTER_TURNOVER" attrName="Service" attrValue="default"/>The form in the database is the form that will allow users to change form parameters. You can add any field you desire. Some field names are reserved: reportContentId, overrideFilters, entityViewName, birtContentType.
<property key="Content.description.CTNT_MASTER_TURNOVER">
<value xml:lang="en">Turnover (product)</value>
<value xml:lang="fr">Rotation (des stocks)</value>
</property>The following diagram shows the Entities linked with Content to store report_master/report. 