Contents
Strategic Partner Links
Sepasoft - MES Modules
Cirrus Link - MQTT Modules
Resources
Knowledge Base Articles
Inductive University
Forum
IA Support
SDK Documentation
SDK Examples
A common requirement is to have a query filter its results for a date range. You can use the Date Range component or a pair of Popup Calendar components to let the user choose a range of dates. Then you can use these dates in your query like this:
SELECT t_stamp, flow_rate, amps FROM valve_history WHERE t_stamp >= '{Root Container.DateRange.startDate}' AND t_stamp <= '{Root Container.DateRange.endDate}'
Notice the single quotes around the braces. This is because when the query is run, the dates will be replaced with their literal evaluations. For example, the actual query sent to the database might look like this:
SELECT t_stamp, flow_rate, amps FROM valve_history WHERE t_stamp >= '2010-03-20 08:00:00' AND t_stamp <= '2010-03-20 13:00:00'
It is important to use single quotes and not double quotes (t_stamp = "2010-03-20 08:00:00") because these mean something different in certain databases like Microsoft SQL Server.
While queries can manually be written on a SQL Query binding, SQL Stored Procedures may also be called from a SQL Query Binding. Note, that the exact syntax is highly dependent on the type of database you are using.
For example, calling a Stored Procedure from MySQL would involve using the CALL command, while SQL Server utilizes the EXEC command.
CALL retrieve_daily_total
EXEC retrieve_daily_total
For more information, please see the SQL Stored Procedures page.