Add a new class to fm_IDL.xml for your data source

Once you have your data source, the next step is to add that data source as a new class in fm_IDL.xml.

You will need to add the following attributes for the class definition

For each column in the view or query output, add field element and set the following attributes. The fields should be wrapped with <field> </field>

For each linking field, add a link element with the following attributes. The elements should be wrapped with <link> </link>

The following example is a class definition for the example view that was created in the previous section.

<class id="erpstats" controller="open-ils.reporter-store" oils_obj:fieldmapper="extend_reporter::patronstats" 
oils_persist:tablename="extend_reporter.patronstats" oils_persist:readonly="true" reporter:label="Patron Statistics" reporter:core="true">
  <fields oils_persist:primary="id">
  <field reporter:label="Patron ID" name="id" reporter:datatype="link" />
  <field reporter:label="Patron Type" name="ptype" reporter:datatype="text" />
  <field reporter:label="Reg Lib" name="reg_lib" reporter:datatype="text" />
  <field reporter:label="Boro/Twp" name="boro_twp" reporter:datatype="text" />
  <field reporter:label="Gender" name="gender" reporter:datatype="text" />
  <field reporter:label="Age Group" name="age_group" reporter:datatype="text" />
  <field reporter:label="Age" name="age" reporter:datatype="int" />
  <field reporter:label="Home Lib ID" name="home_lib_id" reporter:datatype="link" />
  <field reporter:label="Home Lib Code" name="home_lib_code" reporter:datatype="text" />
  <field reporter:label="Home Lib" name="home_lib" reporter:datatype="text" />
  <field reporter:label="Create Date" name="create_date" reporter:datatype="timestamp" />
  <field reporter:label="Expire Date" name="expire_date" reporter:datatype="timestamp" />
  <field reporter:label="Balance Owed" name="balance_owed" reporter:datatype="money" />
</fields>
<links>
  <link field="id" reltype="has_a" key="id" map="" class="au"/>
  <link field="home_lib_id" reltype="has_a" key="id" map="" class="aou"/>
</links>
</class>

Caution

fm_IDL.xml is used by other core Evergreen DAO services, including cstore and permacrud. So changes to this file can affect the entire Evergreen application, not just reporter. After making changes fm_IDL.xml, it is a good idea to ensure that it is valid XML by using a utility such as xmllint – a syntax error can render much of Evergreen nonfunctional. Set up a good change control system for any changes to fm_IDL.xml. You will need to keep a separate copy of you local class definitions so that you can reapply the changes to fm_IDL.xml after Evergreen upgrades.