|  |  |  | 
|---|
|  |  |  | THEN (ATAN(AVG(json->'$.e18[0]'*SIN((json->'$.e23[0]'/180)*PI()))/AVG(json->'$.e18[0]'*COS((json->'$.e23[0]'/180)*PI())))*180/PI())+180 | 
|---|
|  |  |  | ELSE (ATAN(AVG(json->'$.e18[0]'*SIN((json->'$.e23[0]'/180)*PI()))/AVG(json->'$.e18[0]'*COS((json->'$.e23[0]'/180)*PI())))*180/PI())+360 | 
|---|
|  |  |  | END),3) AS '${sensorKey}', | 
|---|
|  |  |  | ROUND(MIN(json->'$.${sensorKey}[1]'),3) AS 'MIN${sensorKey}', | 
|---|
|  |  |  | ROUND(MAX(json->'$.${sensorKey}[2]'),3) AS 'MAX${sensorKey}' | 
|---|
|  |  |  | MIN(json->'$.${sensorKey}[1]') AS 'MIN${sensorKey}', | 
|---|
|  |  |  | MAX(json->'$.${sensorKey}[2]') AS 'MAX${sensorKey}' | 
|---|
|  |  |  | </when> | 
|---|
|  |  |  | <otherwise> | 
|---|
|  |  |  | ROUND(AVG(json->'$.${sensorKey}[0]'),3) AS 'AVG${sensorKey}', | 
|---|
|  |  |  | ROUND(MIN(json->'$.${sensorKey}[1]'),3) AS 'MIN${sensorKey}', | 
|---|
|  |  |  | ROUND(MAX(json->'$.${sensorKey}[2]'),3) AS '${sensorKey}' | 
|---|
|  |  |  | AVG(json->'$.${sensorKey}[0]') AS 'AVG${sensorKey}', | 
|---|
|  |  |  | MIN(json->'$.${sensorKey}[1]') AS 'MIN${sensorKey}', | 
|---|
|  |  |  | MAX(json->'$.${sensorKey}[2]') AS '${sensorKey}' | 
|---|
|  |  |  | </otherwise> | 
|---|
|  |  |  | </choose> | 
|---|
|  |  |  | </foreach> | 
|---|
|  |  |  | 
|---|
|  |  |  | THEN (ATAN(AVG(json->'$.e18[0]'*SIN((json->'$.e23[0]'/180)*PI()))/AVG(json->'$.e18[0]'*COS((json->'$.e23[0]'/180)*PI())))*180/PI())+180 | 
|---|
|  |  |  | ELSE (ATAN(AVG(json->'$.e18[0]'*SIN((json->'$.e23[0]'/180)*PI()))/AVG(json->'$.e18[0]'*COS((json->'$.e23[0]'/180)*PI())))*180/PI())+360 | 
|---|
|  |  |  | END),3) AS '${sensorKey}', | 
|---|
|  |  |  | ROUND(MIN(json->'$.${sensorKey}[1]'),3) AS 'MIN${sensorKey}', | 
|---|
|  |  |  | ROUND(MAX(json->'$.${sensorKey}[2]'),3) AS 'MAX${sensorKey}' | 
|---|
|  |  |  | MIN(json->'$.${sensorKey}[1]') AS 'MIN${sensorKey}', | 
|---|
|  |  |  | MAX(json->'$.${sensorKey}[2]') AS 'MAX${sensorKey}' | 
|---|
|  |  |  | </when> | 
|---|
|  |  |  | <otherwise> | 
|---|
|  |  |  | ROUND(AVG(json->'$.${sensorKey}[0]'),3) AS '${sensorKey}', | 
|---|
|  |  |  | ROUND(MIN(json->'$.${sensorKey}[1]'),3) AS 'MIN${sensorKey}', | 
|---|
|  |  |  | ROUND(MAX(json->'$.${sensorKey}[2]'),3) AS 'MAX${sensorKey}' | 
|---|
|  |  |  | AVG(json->'$.${sensorKey}[0]') AS '${sensorKey}', | 
|---|
|  |  |  | MIN(json->'$.${sensorKey}[1]') AS 'MIN${sensorKey}', | 
|---|
|  |  |  | MAX(json->'$.${sensorKey}[2]') AS 'MAX${sensorKey}' | 
|---|
|  |  |  | </otherwise> | 
|---|
|  |  |  | </choose> | 
|---|
|  |  |  | </foreach> | 
|---|