Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

SS2.4 Custom Reports


Go to End


2387 Views

Avatar
hive.net.au

Community Member, 40 Posts

23 June 2010 at 5:22am

Edited: 23/06/2010 5:23am

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.