User Tools

Site Tools


newdevs:code:report-view

This is an old revision of the document!


Create a New Report Source

If you have a need for data that can only be retrieved via a query because the reporter can't construct it, or if you base numerous reports on a specific set of data that you don't want to have to rebuild every time you create a template, you can create a new class in the fieldmapper that can be used by the reporter going forward.

First, you will need to construct a SQL query that retrieves the data you wish to make available in your source. Once you are satisfied, then you have two options:

Option 1: Create a (faux) View in the Fieldmapper Only

This option adds the SQL directly to the Fieldmapper. This is the easiest approach to code and the reporter (and most other parts of Evergreen) will be able to make use of it, but it does have limitations. For example, it will not be available to a direct database query. Also, other fieldmapper classes cannot link to this class as they would be able to with option 2.

Example Code: https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/mccanna/newdevs-sample-create-view-via-fieldmapper

1. Scroll to the bottom of the fieldmapper. You're going to insert your new class below the last closing </class> tag, and above the <!— *> tag.

NOTE: The Fieldmapper cares about indentation. Make sure to follow the indentation examples from other classes.

Class id

Controller – You have options for what this should be, and you can combine several.

  • open-ils.cstore
  • open-ils.reporter-store
  • open-ils.pcrud

oils_object:fieldmapper

oils_persist:readonly

oils_persist:virtual

reporter:label – What should the name of the view be in the reporter?

newdevs/code/report-view.1690474475.txt.gz · Last modified: 2023/07/27 12:14 by tmccanna

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.