Question:
Can I record/visualize data from a specific batch in an E3 Historic, similarly to what happens with Elipse SCADA?
Solution:
Yes, you can. To do so, follow these procedures:
1. Create two objects: a Database and a Historic.
2. In the Historic, insert the batch fields, and also a field for its name.
3. On the screen, insert two E3Browsers objects (similarly to what happens in Elipse SCADA): one to display batches and another one to display values. In addition, create three buttons: Start Batch, Stop Batch, and Restart Last Batch.
4. Configure the E3Browser’s Batches query to show only the names of the batches. Insert Batch field, and use Group by function.
Alternatively, you can insert the SQL code onto the query’s SQL tab:
SELECT tab_batch.Batch
FROM tab_batch
GROUP BY tab_batch.Batch
This function returns all values of the field, with no repetition.
5. The other E3Browser displays the values of the batch. To do so, set up the query with a filter that returns all rows where the value of Batch column is equal to the one configured at Batch_Name variable.
SQL code:
SELECT tab_batch.E3TimeStamp,tab_ batch.Field1,tab_ batch.Field2,tab_ batch.Field3
FROM tab_batch
WHERE ( tab_batch.Batch = ‘<%Batch_Name%>‘ )
ORDER BY tab_batch.E3TimeStamp ASC
6. Insert the following script into Batch E3Browser’s DblClick event:
batch = GetColumnValue(0)
set query = Screen.Item(“E3Browser2”).Item(“Query1”)
query.SetVariableValue “Batch_Name”, batch
This script retrieves the name of the selected batch (GetColumnValue), which goes to the variable of the query of the other E3Browser.
7. Insert the following scripts into buttons Start Batch, Stop Batch, and Restart Last Batch:
Start Batch:
set batch_name = Application.GetObject(“Data.Batch”)
batch = InputBox (“Insert batch name”)
if batch <> “” then
batch_name.Value = batch
Application.GetObject(“Hist1″).ScanTime = 1000
MsgBox batch_name.Value & ” Started!”
else
MsgBox “Batch name not informed.”
end if
Stop Batch:
batch_name = Application.GetObject(“Data.Batch”).Value
Application.GetObject(“Hist1″).ScanTime = 0
MsgBox batch_name & ” Finished”
Restart Last Batch:
batch_name = Application.GetObject(“Data.Batch”).Value
Application.GetObject(“Hist1″).ScanTime = 1000
MsgBox batch_name & ” Restarted!”
NOTE: Attached to this article is a sample application developed in E3 version 4.0 Build 214.