Missing approval information PGSQL: Difference between revisions

From IMSMA Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 36: Line 36:
If you have any output here you need to take action. The queries below help you to identify for which item(s) the rows in the table ''fieldreport'' need to be updated.
If you have any output here you need to take action. The queries below help you to identify for which item(s) the rows in the table ''fieldreport'' need to be updated.


=== Accident===__NOEDITSECTION__
<pre>
</pre>
=== Hazard ===__NOEDITSECTION__
<pre>
</pre>
=== Hazard Reducation===__NOEDITSECTION__
<pre>
</pre>
=== Location===__NOEDITSECTION__
<pre>
</pre>
=== MRE===__NOEDITSECTION__
<pre>
</pre>
=== QM===__NOEDITSECTION__
<pre>
</pre>
=== Victim===__NOEDITSECTION__
<pre>
</pre>
== Example update query==__NOEDITSECTION__
<pre>
</pre>
{{NavBox Hub}}
{{NavBox Hub}}
[[Category:NoPublic]]
[[Category:NoPublic]]
[[Category:SQL Queries]]
[[Category:SQL Queries]]

Revision as of 23:44, 13 November 2016

will add more queries.

How it should NOT look like

Depending on the reason why the approval information is missing there are different combinations:

  • only Approval date missing
  • only Approved by missing
  • both missing.

The solution is of course depending on what is missing. It is important' that the approval information is set and only rows with workbench status = Approved are included.

Missing approval information

SELECT
"public".fieldreport.fieldreport_localid AS "Form ID",
"public".fieldreport.dateofreport AS "Date of Information",
"public".fieldreport.reportreceiveddate AS "Data Entry Date",
"public".fieldreport.reportcompleteddate AS "Submitted Date",
"public".fieldreport.reportverifieddate AS "Approved Date",
"public".fieldreport.verifiedby AS "Approved by",
"public".fieldreport.dataenterer AS "Data enterer",
workbench_status.enumvalue
FROM
fieldreport
Inner Join imsmaenum AS workbench_status ON (workbench_status.imsmaenum_guid = fieldreport.workbenchstatusenum_guid)
WHERE
workbench_status.enumvalue =  'Approved' AND
(fieldreport.reportverifieddate IS NULL  OR
fieldreport.verifiedby IS NULL )
ORDER BY
"Form ID" ASC

If you have any output here you need to take action. The queries below help you to identify for which item(s) the rows in the table fieldreport need to be updated.

Accident


Hazard


Hazard Reducation


Location


MRE


QM


Victim


Example update query


Template:NavBox Hub