Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-75770

Exception when trying to aggregate sum() checkbox user profile field

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 4.0.4
    • Report builder
    • None
    • MOODLE_400_STABLE

      1. Create a user profile field of type 'checkbox'
      2. Create a custom report from the "Users" datasource and add the column for this field.
      3. Set aggregation on this column to 'Sum', 'Average' or 'Percent'
      4. Boom

      ERROR:  function sum(text) does not exist
      LINE 3: ...S c1_timeadded, SUM(u.confirmed) AS c2_confirmed, SUM(rbalia...
                                                                   ^
      HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
       
                  SELECT COUNT(1)
                    FROM (SELECT c.name AS c0_name, cm.timeadded AS c1_timeadded, SUM(u.confirmed) AS c2_confirmed, SUM(rbalias2.data) AS c3_data, MIN(rbalias3.data) AS c4_data
                            FROM mdl_cohort c LEFT JOIN mdl_cohort_members cm
                      ON cm.cohortid = c.id LEFT JOIN mdl_user u
                      ON u.id = cm.userid LEFT JOIN mdl_user_info_data rbalias2 ON rbalias2.userid = u.id AND rbalias2.fieldid = 14 LEFT JOIN mdl_user_info_data rbalias3 ON rbalias3.userid = u.id AND rbalias3.fieldid = 15
                           WHERE (c.name NOT ILIKE $1 ESCAPE '\')
                                 GROUP BY c0_name, c1_timeadded
                         ) rbalias12
      [array (
        0 => '%cohort2%',
      )]
      Error code: dmlreadexception
      * line 494 of /lib/dml/moodle_database.php: dml_read_exception thrown
      * line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
      * line 341 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->read_slave_query_end()
      * line 1027 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
      * line 1679 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->get_records_sql()
      * line 1752 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
      * line 1962 of /lib/dml/moodle_database.php: call to moodle_database->get_field_sql()
      * line 179 of /reportbuilder/classes/table/base_report_table.php: call to moodle_database->count_records_sql()
      * line 365 of /reportbuilder/classes/table/custom_report_table.php: call to core_reportbuilder\table\base_report_table->query_db()
      * line 262 of /lib/table/classes/external/dynamic/get.php: call to core_reportbuilder\table\custom_report_table->out()
      * line ? of unknownfile: call to core_table\external\dynamic\get::execute()
      * line 261 of /lib/externallib.php: call to call_user_func_array()
      * line 81 of /lib/ajax/service.php: call to external_api::call_external_function()
      * 

            Unassigned Unassigned
            marina Marina Glancy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.