Coder Social home page Coder Social logo

Comments (4)

nyeholt avatar nyeholt commented on September 24, 2024

It's something that would be nice - for the moment, if you're wanting fields from a relationship, you need to create your own AdvancedReport (or DataObjectReport) subclass and manually add in the fields the user can select by

  • Override getReportableFields() to add in the field value the user can select
  • Override getDataObjects() to provide your own logic for selecting the data objects to include in the report.

from silverstripe-advancedreports.

srmcatee avatar srmcatee commented on September 24, 2024

Thank you for your assistance.

I've started building my own obeject. Everything looks good but when
I go to run preview on the report I get this error:

error_log(/var/log/silverstripe): failed to open stream: Is a directory
error_log([22-Sep-2011 06:28:48] Error at
advancedreports/code/dataobjects/AdvancedReport.php line 359: Uncaught
Exception: Abstract method called; please implement getDataObjects()
(http://localhost/hiho2/admin/advanced-reports/DirectoryReport/14/preview)
,3,/var/log/silverstripe,)
Line 57 of LogFileWriter.php

I've modified permissions on /var/log/silverstripe to 777. I've also
chown and chgrp to www-data. Nothing fixes it.

Can you advise what advanced report is trying to do here?

Thank you.

Steve

Quoting nyeholt
[email protected]:

It's something that would be nice - for the moment, if you're
wanting fields from a relationship, you need to create your own
AdvancedReport (or DataObjectReport) subclass and manually add in
the fields the user can select by

  • Override getReportableFields() to add in the field value the user
    can select
  • Override getDataObjects() to provide your own logic for selecting
    the data objects to include in the report.

Reply to this email directly or view it on GitHub:
#1 (comment)

from silverstripe-advancedreports.

nyeholt avatar nyeholt commented on September 24, 2024

The important bit is

Uncaught Exception: Abstract method called; please implement getDataObjects()

Your report subclass needs to implement this method to return the actual data objects that will be displayed in the report. Check the DataObjectReport class for an example.

from silverstripe-advancedreports.

srmcatee avatar srmcatee commented on September 24, 2024

K. That is fixed.

Now my final issue. I'm trying to include fields from a hasmany table that relates to my primary table.

I modified getReportableFields to reference one of my other tables. In the example code below I have a primary table "Family" and another table "Individual". The relationship that relates them is "Individuals". So here is the code:

protected function getReportableFields() {
$fields = array(
'ID' => 'ID',
'Created' => 'Created',
'LastModified' => 'LastModified',
);
if ($this->ReportOn) {
$dbfields = Object::combined_static($this->ReportOn, 'db');
$addtl=array('Individuals.FirstName'=>'Individuals.FirstName');
$fields=array_merge($fields,$dbfields);
$fields=array_merge($fields,$addtl);
$fields = array_combine(array_keys($fields), array_keys($fields));
....

The field is displayed but comes up blank when I generate the report. How do I get the report to pull the selected field value from a hasmany relationship?

}

from silverstripe-advancedreports.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.