Jump to:

23471 Posts in 18941 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » SS_Report problems

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 139 Views
  • quanto
    Avatar
    Community Member
    81 Posts

    SS_Report problems Link to this post

    I have two problems when i upgraded a site from 2.4 to 3.1:
    problem 1: I'm trying to show xxx fields from parameterFields This doesn't work. The $params field remains empty
    problem 2: I'm trying to export the report to csv, however after export I only get the ID's in my csv..

    <?php

    class CustomSideReport_TipcompetitieReport extends SS_Report{
    function title() {
    // the name of our report
    return "Tipcompetitie";
    }

    function sourceRecords($params) {

    //$Pages = DataObject::get("TipcompetitieZend", null, "Kortebaan DESC", null, $limit);
    $limit = isset($params['ResultsLimit']) ? $params['ResultsLimit'] : '';
    $Pages = TipcompetitieZend::get()->sort("Kortebaan DESC")->limit($limit);//, null, $limit);
    return $Pages;
    }

    function columns()
    {
    $fields = array(
    'Naam' => array(
    'title' => 'Naam'
    ),
    'Woonplaats' => array(
    'title' => 'Woonplaats'
    ),
    'Kortebaan' => array(
    'title' => 'Kortebaan'
    ),
    'Emailadres' => array(
    'title' => 'Baan'
    ),
    'nr1' => array(
    'title' => 'Nummer 1'
    ),
    'nr2' => array(
    'title' => 'Nummer 2'
    ),
    'nr3' => array(
    'title' => 'Nummer 3'
    ),
    'nr4' => array(
    'title' => 'Nummer 4'
    ),

    'Created' => array(
    'title' => 'Invoerdatum',
    'casting' => 'SS_Datetime'
    )

    );
    return $fields;
    }

    public function parameterFields()
    {
    $params = new FieldList();

    //Result Limit
    $ResultLimitOptions = array(
    50 => '50 Aanmeldingen',
    100 => '100 Aanmeldingen',
    200 => '200 Aanmeldingen',
    500 => '500 Aanmeldingen',
    Null => 'Alle aanmeldingen'
    );

    $params->push(new DropdownField(
    "ResultsLimit",
    "Aantal aanmeldingen weergeven",
    $ResultLimitOptions/*,
    10*/
    ));

    return $params;
    }
    }
    ?>

    139 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.