Uploaded image for project: 'Reporting Module'
  1. Reporting Module
  2. REPORT-648

NULL parameter error with SQL Dataset

    Details

    • Type: Bug
    • Status: Closed
    • Priority: TBD
    • Resolution: Fixed
    • Affects Version/s: Reporting 0.8.2
    • Fix Version/s: Reporting 0.9.3
    • Component/s: None
    • Labels:
      None
    • Complexity:
      Undetermined

      Description

      If a parameter, location for example, has no value selected, but is referenced in the SQL, the query fails with the following...

      An Internal Error has Occurred
      java.lang.RuntimeException
      org.openmrs.module.reporting.evaluation.parameter.ParameterException: Cannot bind an empty value to parameter location. Please provide a real value or use the 'IS NULL' constraint in your query (e.g. 'table.columnName IS NULL').

      This happens even if you are checking to see if the parameter is null. Thus queries like this also fail.

      SELECT IFNULL(:location,0);
      SELECT COALESCE(:location,1);
      SELECT * FROM location WHERE :location IS NULL;
      

      Replacing :location with NULL in all of those queries allows them to execute without error.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mseaton Mike Seaton
                Reporter:
                arbaughj James Arbaugh [X] (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: