Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

reportbuilder/Adding a Column: Difference between revisions

From MoodleDocs
(Created page with "Back to Index A simple column option looks like this: <pre> $this->columnoptions = array( new rb_column_option( 'course', ...")
 
(Note about plan not to migrate this page to the new developer resources. See template for more info.)
 
Line 1: Line 1:
{{Template:WillNotMigrate}}
[[reportbuilder|Back to Index]]
[[reportbuilder|Back to Index]]



Latest revision as of 14:06, 24 June 2022


Warning: This page is no longer in use. The information contained on the page should NOT be seen as relevant or reliable.


Back to Index

A simple column option looks like this:

        $this->columnoptions = array(
            new rb_column_option(
                'course',
                'fullname',
                'Course Fullname',
                'base.fullname'
            )
        );

Every column option object must include 4 required arguments:

  • Column Type. A string which describes the type of the column. Typically this might be the same as the table name, and is used to group similar sorts of columns together
  • Column Value. A string describing the column more specifically. Together the type and value must be unique within a source, and are used to reference the column elsewhere in the source.
  • Column name. A string which describes the column. This appears in the pulldown menu when choosing columns, and is also the default column heading in the report.
  • Column field definition. A snippet of SQL which describes how the database should access the column. Typically this will be of the form 'base.[field name]' to access fields in the base table, or '[join name].[field name]' to access fields from other tables (see below).

Once this column option is added to the source, a new option should appear in the pulldown on the columns tab of the report settings page.

See also advanced column options and [rb_column_option documentation].