Archive Batch Data (event-based archiving)
Users may need to archive batch data as may be the case in injection molding machines, testing apparatuses, pharmaceutical ingredient production, etc. The unique aspect of this activity is OPC Expert should only archive data when a “batch complete” event occurs. Consider the following case:
| Time | Batch | Pressure | Temperature | Complete | Status |
| 00:00 | 1 | 12.4 | 50.4 | FALSE | FAIL |
| 00:02 | 1 | 23.9 | 52.9 | FALSE | FAIL |
| 00:34 | 1 | 33.2 | 55.3 | TRUE | PASS |
| 01:23 | 2 | 12.2 | 50.1 | FALSE | FAIL |
| 04:58 | 2 | 24.7 | 53.8 | FALSE | FAIL |
| 06:36 | 2 | 27.9 | 53.2 | FALSE | FAIL |
| 06:40 | 2 | 31.2 | 54.3 | FALSE | FAIL |
| 07:22 | 2 | 33.4 | 55.5 | TRUE | PASS |
| 08:44 | 3 | 12.3 | 50.2 | FALSE | FAIL |
Real-time data (users do NOT want to archive this data)
| Time | Batch | Pressure | Temperature | Complete | Status |
| 00:34 | 1 | 33.2 | 55.3 | TRUE | PASS |
| 07:22 | 2 | 33.4 | 55.5 | TRUE | PASS |
| 10:23 | 3 | 33.2 | 55.2 | TRUE | PASS |
| 15:57 | 4 | 34.3 | 54.0 | TRUE | PASS |
| 22:02 | 5 | 33.6 | 55.7 | TRUE | PASS |
| 27:43 | 6 | 35.2 | 20.2 | TRUE | FAIL |
| 36:23 | 7 | 33.7 | 55.6 | TRUE | PASS |
| 45:12 | 8 | 33.6 | 19.3 | TRUE | FAIL |
| 52:21 | 9 | 33.9 | 55.4 | TRUE | PASS |
Batch data (users want to have this result)
Note: We capture data when OPC Item “Complete” is TRUE, and we do so only once.
To achieve the above result, follow the procedure below:
- In OPC Expert, subscribe to the items to archive

- Select all items, right-click items and, from the right-click menu, select (Archive -> Create new archive)

- In “Create New Archive” dialog box, select the necessary format (any of these will work)

- Select necessary options and click “OK”

- In OPC Expert’s “Archive” tab, right-click the item we need to trigger (OPC Item “Complete” in this example), and select (Trigger -> Add Trigger) from the right-click menu

- In tab “Trigger Event”, select options as below.

- In tab “Action”, check “Synchronize Archive”. Note, when OPC Expert detects this trigger, it will send all values to the archive. OPC Expert will only do this one time. So even if the trigger remains TRUE for an hour, OPC Expert will only archive a single snapshot in time. Other options are available to archive while the trigger is TRUE.

- In tab “Options”, select options as below and click OK

- In tab “Archive” click button “Start”
Note the following:
- OPC Expert will check this item whenever it changes, and will archive the value when the trigger is true. The trigger will then have to be false before OPC Expert will consider archiving it again.
- All items are in a “Paused” state. This means the archive is active, but it is not archiving anything until it resumes (not paused) for 1 poll. After the poll, the archive will be paused again.
- After clicking button “Start”, OPC Expert will appear as follows and will archive data as per considerations above. Also, note all items are paused.

The above procedure enables users to properly archive data whenever a batch is complete. To visualize the data, users can use OPC UA HA to retrieve the data, or use OPC Expert’s Excel add-in to quickly create reports as follows:
- In OPC Expert’s main menu, select (Tools -> Options)

- In dialog box “Options”, select “General” tab and check “Enable Excel features”
Note you may also need to change the following:
- Separator, which is a semicolon ; in many locations
- Decimal, which is a comma in many locations
- Language, which must match Excel’s language
- Run Excel and begin by testing your setup. From the main menu, select “OPC” and click button “OPC Status”.
Ensure the following is true:
- Line 1: RTD (Real-Time Data) is functioning properly
- Line 2: Historical data is functioning properly
- Line 3: UDF (User Defined Functions) is functioning properly
- Line 4: OPC Expert is available
- Line 5: Shows a number between 0 and 59 and increments each second
- Line 6: Shows either “32 Bit Process” or “64 Bit Process”
- After completing the test above, clear the current spreadsheet (delete all content) and click button “Historian Data”

- Drag items from OPC Expert’s “Archive” tab into Excel’s “Historian Data” dialog box

- In dialog box “Excel Data”, fill the necessary “From” and “To” fields and ensure to select radio button “Raw (Stored) Values” and click OK

- Excel should now show your report

- Format table as necessary
