OFMVSTATDATE returns the date/time for a summary statistic for a list of variables from a different Facility. Variables can be of different types (IE Calculated, Daily, Hourly,etc...).
SYNTAX:
OFMVSTATDATE("Facility","Stat",Offset,Grouping, "DateFormat", VarId1, VarId2,…VarId99)
or
OFMVSTATDATE("Facility","Stat”,Offset, Grouping, "DateFormat","Where Clause")
Facility: Facility to query against, specified by its unique identifier in quotes (e.g. "OPSWWTUTOR")
Stat: The statistic in quotes (ie "MAX") of the value to calculate. NOTE: only works for statistics that return a single value (i.e. Max, Min) not aggregate functions such as Avg, Sum as there is no specific date where the statistic occurs.
Stat |
Notes |
Max |
Maximum value |
Max_VarNum |
Returns the Variable Number of the variable that has the maximum value. |
Min |
Minimum value |
Min_VarNum |
Returns the Variable Number of the variable that has the minimum value. |
First |
First value found by date |
First_VarNum |
The variable number of the variable that is the first value found. |
Last |
Last value found by date |
Last_VarNum |
The variable number of the variable that is the last value found. |
GroupOffset/StartDate: Used with the Grouping parameter to set the dates to calculate the stat for. Sets the number of Groups (set by the Grouping Parameter) to be added to set the dates. See examples below. If this field is a date string (i.e. "07/16/2004") or refers to a cell with a date in it, it is assumed to be the start date to calculate the stat for.
Grouping/EndDate: Used to set which dates to calculate the stat for. If the Grouping is a date literal string (i.e. "07/16/2004") or refers to a cell with a date in it, it is assumed to be the end date to calculate the stat for. Common Groupings are:
"D" Days
“M” Monthly
"R" Report Dates
Click here for available Grouping options
DateFormat: Date Format (i.e. "mm/dd/yyyy"...) to return.
VarId1..VarId99: A comma separated list of variables that sets which variables to calculate from. NOTE: This function uses VARIDs, not Varnums.
OR
Where clause Instead of providing a list of variables, you can use an SQL Where clause against the VarDesc table to get the list of variables. I.E. “Units = 'mg/L'” wound return all variables with Units set to mg/L. See Examples.
SEE ALSO:
MVSTAT, MVSTATDATE, MVSTATZ, OFMVSTAT, OFMVSTATZ
EXAMPLES:
OFMVSTATDATE("OPSWWTUTOR","MIN",1,"M","mm/dd/yyyy hh:nn",37,40) Returns the Date/Time (i.e. 04/22/2008 07:00) of the minimum value for the start month of the report for varids 37 and 40 (Varnums 4011 and 4041) from the OPSWWTUTOR facility.
OFMVSTATDATE("OPSDWTUTOR","MAX",1,"M","mm/dd/yyyy","UNITS = 'mg/L'") Returns the Date (i.e. 04/22/2008) of the maximum value for the start month of the report for variables that have mg/L as their units from the facility OPSDWTUTOR.