IMD SolutionComputing LibraryShop main store

Troubleshooting

Event logging in Ignition Edge with one delimited string tag

Edge computing and IIoT Published 7 min read

Short answer

Arrays, datasets, UDTs and alarm associated data each break event logging on Edge: arrays split one event into one row per element, dataset history is not stored, and associated data cannot be queried centrally after sync. Historize a single delimited expression string tag in a tag group with rate negative one, trigger it from a tag change script, and parse the stored strings back into columns for tables and reports.

On this page
  1. Why do array, dataset, and UDT history split one event into many rows?
  2. Why doesn't alarm associated data work as the event log?
  3. How does one delimited string tag hold the whole event?
  4. How do I make the string log only when an event fires?
  5. How do I parse the stored strings back into table columns?
  6. How many events does the Edge historian's local store hold?
  7. Which pattern should you deploy at the machine?
  8. Questions asked

You cannot get one-row-per-event logging on Ignition Edge from array tags, dataset tags, UDTs or alarm associated data; each fails for a specific, checkable reason. The working pattern is one delimited expression string tag that carries the event text and every process value, historized in a tag group with rate negative one so it stores only when an event fires, then parsed back into columns by a project library function for tables and reports. The record stays local on the Edge node and forwards with the historian's own store-and-forward queue, so a poor cellular link does not push logging onto the central server.

Why do array, dataset, and UDT history split one event into many rows? #

A top-level array is historized element by element, dataset and document tags store no usable history at all, and a UDT is recorded member by member, so none of the three can freeze a whole event into one row. Work the failures in order, because each one tells you what the next attempt must avoid:

  1. Array write. Writing [1, 2, 3, 4, 5, 6] and then [6, 5, 4, 3, 2, 1] in a single system.tag.write call produces six history rows, not one: each element is historized as its own sub-tag, so one write call never makes the record atomic.
  2. Dataset tag. The tag historian does not store values for dataset or document tags, so a history-enabled dataset leaves you nothing to query.
  3. UDT members. History on the UDT records each member independently, so the members of one event land in different rows with no shared key.

The Ignition user manual describes array and dataset tags as containers holding multiple data points in one tag; the historian simply does not treat that container as a single value, and that is the whole problem.

Why doesn't alarm associated data work as the event log? #

A diagnostic alarm with associated data stores on the Edge node and syncs to the central server, but the associated data cannot be pulled into a table or a report from the central side, so the record exists where you cannot read it. The alarm journal forwards correctly, which is what makes this failure frustrating: the path passes the connectivity test and fails the retrieval test. On the Edge node you can see the full record; at the central server only the alarm text and status arrive, not the associated fields. The same field-name mapping shows up from the display side in how alarm columns use associated data field names, for the same underlying reason. Treat alarm associated data as a local diagnostic, never as the event log of record.

How does one delimited string tag hold the whole event? #

One string tag is a single scalar to the historian, so every on-change record carries the event text and every frozen process value together in one row; build it as an expression tag that alternates field names and field values around a delimiter:

concat(
  'Event,',   {[.]EventString},
  ',AirPSI,', toStr({[.]AirPSI}),
  ',Seq,',    toStr({[.]EventSeq})
)

The tag paths here are examples; substitute your own. The name-value alternation lets the parser rebuild column names from the data itself. Three rules keep the rows clean:

  • Pick a delimiter that cannot appear in any field. If operator-entered text can carry a comma, strip it in the expression or switch both the expression and the parser to another character; the two sides must agree.
  • Include a sequence counter or timestamp field. On-change recording skips a new value identical to the last stored one, so two identical events with identical process values collapse into one row without it.
  • Keep the field order and count fixed. Headers are read from the data, so a variable field count produces ragged rows.

Leave the tag's history on plain on-change recording with no aggregation, because the mode decides what tag history stores — the same interaction described in why the Auto deadband style delays and doubles tag history storage. Check the historian's string column size for your Edge version before stacking in many fields, and confirm your longest expected string round-trips intact.

How do I make the string log only when an event fires? #

Put the expression tag in its own tag group with the execution rate set to negative one, which means the group never evaluates on a timer, and have a gateway tag change script request exactly one execution when the event string changes:

  1. Create a dedicated tag group — EventLoggerGroup is the example name here — and set its execution rate to -1.
  2. Assign the delimited expression tag to that group.
  3. Add a gateway tag change script on the event string tag:
if not initialChange:
    system.tag.requestGroupExecution("edge", "EventLoggerGroup")

edge is the example tag provider name and is the first argument; the group name is the second. The initialChange guard keeps a gateway restart or tag resubscription from writing a phantom event.

The requested execution is asynchronous: the process values are sampled when the group actually runs, a short interval after the string changes. Treat the row timestamp as the evaluation time, not the button press, and if the record must carry the instant of the action, write a timestamp field from the same script that changes the event string.

How do I parse the stored strings back into table columns? #

Query the string tag's history with the built-in history query, split each stored value on the delimiter, and rebuild a dataset with the row timestamp as the first column, so one stored row becomes one table row:

# Project library script: Events
def getDataset(path, start, end):
    hist = system.tag.queryTagHistory(paths=[path], startDate=start, endDate=end, returnSize=-1)
    py = system.dataset.toPyDataSet(hist)
    col = py.getColumnName(1)
    headers = []
    rows = []
    for row in py:
        raw = row[col]
        if raw is None:
            continue
        parts = raw.split(",")
        headers = parts[0::2]
        rows.append([row[0]] + parts[1::2])
    return system.dataset.toDataSet(["t_stamp"] + headers, rows)

path, start and end are this function's own arguments; system.tag.queryTagHistory, system.dataset.toPyDataSet and system.dataset.toDataSet are the documented calls. Bind a table or report data source with the runScript expression function, for example runScript('Events.getDataset', 1000, path, start, end), where the second argument is the re-run interval in milliseconds and 1000 is an example value.

Verify the query returns every stored row: an aggregated or interpolated history query will drop or reshape rows, so force the unaggregated return this example uses and compare the returned row count against the number of events you triggered. Two fixes belong in the function before commissioning: headers come from the last row read, so pad or reject short rows when the field set changes, and convert numeric columns inside the function if the table needs sorting or numeric formatting. For a tail view of the same store, the pagination in getting the last N stored records from a tag history query applies unchanged, because a string tag is queried like any other.

How many events does the Edge historian's local store hold? #

On Edge the local store holds one week of history or ten million rows, whichever comes first, with up to 250 tags trended; confirm those figures against your Edge version's datasheet, then check your event rate against the cap the way this example does. Say the machine records 500 events per day. One week is 500 × 7 = 3,500 rows, which is 3,500 ÷ 10,000,000 = 0.035 percent of the row cap, and the logger spends one of the 250 trended tags. Even at ten times that rate the week is 35,000 rows, 0.35 percent of the cap, so the row limit never decides this design; the one-week window does. Rows forwarded to the central historian stay archived there, and the week bounds only what the Edge node keeps locally — before you call a week of events delivered, run the checks in when store-and-forward buffered data counts as stored in the historian, because a flushed queue marker is not the same as confirmed rows.

Which pattern should you deploy at the machine? #

Deploy the delimited string tag for every event that must read as one row at the central server; keep alarm associated data for local on-node diagnostics only, and drop array, dataset and UDT history for event capture. The decision per path:

  • Delimited string tag in the tag historian — stores locally, forwards on the historian queue, queries centrally as columns: use it.
  • Alarm journal with associated data — forwards, but the associated fields are unreachable centrally: local diagnostics only.
  • Array, dataset or UDT history — splits one event across rows: rejected for event capture.

One safety boundary: this log records what the operator did and the process state around it, and on equipment that supports life it is a record, never a safety function — the certified safety loop stays entirely outside this historian path.

Questions asked

Does this pattern survive a cellular outage between Edge and the central server?

Yes. The rows are ordinary tag history, so they queue in the Edge historian's store-and-forward buffer during the outage and flush on reconnect; nothing about a comma-delimited string changes that path. After a reconnect, confirm the buffered rows actually landed by querying a known event, value and timestamp rather than trusting the queue marker.

What delimiter should I pick if an operator can type a comma into the event text?

Pick one that cannot occur in any field, and enforce it inside the expression itself. Strip commas from the event string in the concat call, or switch both the expression and the parser to a vertical bar, which also survives decimal commas in process values. Parser and expression must agree on the delimiter or every row misaligns.

Where should the parser function live?

In a project library, not in the component that calls it. One library function means the table, the report data source and any view all parse the same strings with the same rules, so a delimiter or field-order fix happens in one place. Call it with the runScript expression function and pass the tag path and date range as parameters.

The process values moved right after the button press. Which values does the row carry?

The values present when the tag group actually executes, a short interval after the event string changes, because the requested execution is asynchronous. If the record must freeze the state at the instant of the action, build the string inside the same tag change script that fires the group, from the values read at that moment.

Keep reading

  • Comparison

    Ignition tag historian versus transaction groups

    Use the Ignition tag historian for trends: it logs by exception against a deadband, compresses what it stores (around 54% average compression observed in the field), and partitions data into monthly tables. Keep transaction groups wherever an outside SQL consumer such as a PHP report reads a table you designed. Run both, and give each tag one home based on who consumes it.

    Edge computing and IIoT

  • Troubleshooting

    Why Edge historian gaps look like held values centrally

    The single _exempt_ row in sqlth_sce and the empty sqlth_scinfo are designed behavior: the Edge Historian neither tracks nor validates scan classes, locally or over sync, so an outage queries as a held last value on the central gateway. Add a PLC-sourced heartbeat tag, detect holes in its rows as outage windows, and subtract them from runtime totals - a weekend outage otherwise overstated runtime by 16 hours.

    Edge computing and IIoT

  • Explainer

    Why two Ignition historian connections share one pruning boundary

    No. Two database connections pointed at the same SQL Server database give the tag historian two logical routes into one shared table set, and pruning deletes whole partition tables, so the 3-month policy can remove data marked never prune. Put each retention policy in its own database on the same instance.

    Edge computing and IIoT