Using Databases in E3: Chapter 5 – Inserting Records.

There are two ways to insert new records in a database in addition to using native E3 objects: via a Query or via scripts.

If record insertion is performed via Query, you must configure the SQL code of the Query this way:

INSERT INTO Table1 (Batch, Batch_Quality, User, User_Quality, E3TimeStamp)
VALUES ('<%Batch%>', 192, '<%User%>', 192, #<%StartDate%>#)

NOTE: This SQL configuration is valid for any database.

In case record insertion is performed via script, the command to use is WriteRecord. This type of script can be configured to insert records manually, via a button script, or automatically, when a property changes its value.

In the configuration of a Historic with manual recording, you must configure the recording time for new records with zero and, after that, develop a script using the WriteRecord method on a button or on a property. The following example shows a script on a button.

Figure 1: Script used in a button

Exercise

  1. Create a button with a script using the WriteRecord method.
  2. Insert an E3Browser on the Screen, link it to the Historic previously created and configure it to update itself every 1000 ms.
  3. Check whether the value was recorded.
Este artigo foi útil? Was this post helpful?
Yes0
No0

Deixe seu Comentário

Seu endereço de e-mail não será publicado. Campos marcados com asterisco são obrigatórios *