Jump to:

5453 Posts in 1674 Topics by 1198 members

Customising the CMS

SilverStripe Forums » Customising the CMS » SS2.4 Custom Reports

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1081 Views
  • hive.net.au
    Avatar
    Community Member
    40 Posts

    SS2.4 Custom Reports Link to this post

    I had some custom reports in 2.3 and now in 2.4 they no longer work I have found most of the changes in the updated SS_reports class however when I override getReportField() with out inheriting the parent data nothing is displayed.

    The following just displays no form at all the report just has the title and description of the report.

    function getReportField() {
          
          $fields = Contact::$table_overview_fields;

             $table = new ComplexTableField(
    $this,
             'Contacts',
             'Contact',
             $fields
          );
    $table->Markable = true;
    $table->showPagination= false;
          

          
          $table->setFieldCasting(array(
             'Created' => 'Date'
          ));
          $table->setFieldListCsv(array(
           'Surname' => 'Surname',
           'FirstName' => 'First Name'
          ));
          $table->setPermissions(array(
             'export'
          ));
          $table->setPageSize(250);
          $table->csvHasHeader= true;
          return $table;
       }
    function getCustomQuery() {
          
                //buildSQL($filter = "", $sort = "", $limit = "", $join = "", $restrictClasses = true, $having = "")
             $query = singleton('Contact')->buildSQL('', 'Contact.Surname DESC');
             $query->groupby[] = 'Contact.Created';
             return $query;
          
       }

    Any help or advise would be great.

    1081 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.