We have prepared an example in the demo project that came together with IntegraXor to showcase this feature. In the demo, we wanted to produce a report that shows the value of cooking pressure that is greater than the average value.
Have a look at the trend page and you can see that the we have deliberately made the cooking pressure value fluctuates quite a bit.
Now go to the Cooking Pressure page under Stored SQL Reports and select a date. If you just ran the demo, just click today's date. You should see the table populated with a list of values that are greater than the average value shown below the date.
So how do we do this? In our case, we picked one tag, pressure_cook, to be used to showcase this but of course the sky is the limit with what you can configure with your SQL statement and your database.
We first prepared the SQL statement itself. For our scenario, we stored 2 separate SQL statements, avgval and pcookgta.
You can find these two statements when you open up our demo project in Project Editor and navigate to Stored SQL Statements under Database.
After preparing the SQL statement, we started creating the html page which will be used to invoke the SQL statement and then format and display the result. Displaying the whole HTML page here is pointless, you can instead see the contents (including the Javascript examples to invoke the SQL statements) of the HTML page that we created in the demo project folder named pcook.html
The final step is adding the created HTML page into the demo project Screen list and we are good to go!