How can I access E3Storage data from a regular query while filtering it by date?
Solution:
To filter data via E3TimeStamp field, the query will search for a numeric interval instead of dates, since the E3TimeStamp field is recorded by E3Storage in Float type. To do so, the query filter must not have the character ‘#‘, which indicates date.
Example of SQL query:
SELECT E3TimeStamp,FieldID,FieldValue
FROM TableSQL
WHERE E3TimeStamp >= <%IniDate%> AND E3TimeStamp <= <%EndDate%>
In this example, there are two displays, one for the Initial Date and another for the End Date, and both have their SetPointDataType property set as stDateTime. The query button has the following script:
set cns = Screen.Item(“E3Browser1”).Item(“QuerySQL”)
cns.SetVariableValue “IniDate”, CDbl(Screen.Item(“Display1”).Value)
cns.SetVariableValue “EndDate”, CDbl(Screen.Item(“Display2”).Value)
Screen.Item(“E3Browser1”).Requery()
That is, the CDbl function will convert the date into a number, and thus it will be the equivalent to the value stored at the E3Storage’s table on E3TimeStamp column.
NOTE: E3Storage can only be used with SQL Server or Oracle databases.