We did this (with Galen's help) and I will try to elaborate on his answer.
Here's what we did
1. Created some additional views in the extended reporter schema
2. Save a copy of the original fm_IDL.xml
3. Add information about the new views to /openils/conf/fm_IDL.xml, using
previous entries as a model. Make sure you're the opensrf user when working
with this file.
a class definition with the following attributes
id
controller="open-ils.cstore"
ils_obj:fieldmapper="extend_reporter::long_name_of_view"
oils_persist.readonly="true"
reporter:core="true" (if you want this to show
up as a "core" reporting source)
reporter:label
For each column in the view or query output, add a field element and set the
following attributes. Make sure these are wrapped in the fields container
element:
reporter:label
name
reporter:datatype (which can be id, bool, money, org_unit, int,
number, interval, float, text, timestamp, or link)
For each linking field, add a link element with the following attributes,
wrapped in the link container element:
field (should match field.name)
reltype ("has_a", "might_have", or "has_many")
map ("")
key (name of the linking field in the foreign table)
class (ID of the IDL class of the table that is to be linked to)
4. Update the version of fm_IDL.xml used by the reporter
cp /openils/conf/fm_IDL.xml /openils/var/web/reports/fm_IDL.xml
5. Run autogen as the opensrf user
/openils/bin/autogen.sh
6. Restart C as the opensrf user
osrf_ctl.sh -l -a restart_c
7. Restart reporter. We're running all on server, I think you need to do
something slightly different with the -l option here for other configurations
opensrf-perl.pl -l -action restart -service open-ils.reporter -config
/openils/conf/opensrf_core.xml -pid-dir /openils/var/run
8. In the Evergreen Staff Client, you will need to either restart or clear
cache (via Admin | For developers | Clear cache).
If do you any upgrades, you'll want to compare the new fm_IDL.xml to the one
you modified, and if there's differences add your views to the new fm_IDL.xml.
Be careful because this file is used by the entire application and not just
the reporter.
Hope this helps.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Galen
Charlton
Sent: Thursday, February 17, 2011 2:05 PM
To: Evergreen Discussion Group
Subject: Re: [OPEN-ILS-GENERAL] Creating Database Sources for reports
Hi,
On Feb 17, 2011, at 1:25 PM, Tim Spindler wrote:
> I was playing around trying to add another database source. I thought all
> you had to do was create view in postgres but apparently not. My view is not
> showing up in the list of sources. I was wondering what you needed to do if
> you wanted to create a different source?
*Very* briefly, the table or view also should be defined in fm_IDL.xml for it
to show up as a reporting source. Hopefully somebody will jump in with a more
detailed answer, but I hope this gets you started.
In haste,
Galen
--
Galen Charlton
VP, Data Services
Equinox Software, Inc. / Your Library's Guide to Open Source
email: [email protected]<mailto:[email protected]>
direct: +1 352-215-7548
skype: gmcharlt
web: http://www.esilibrary.com/