Skip to Content
Documentation06 · Alarms & historyHistory queries & export
On this page

Data Query

Open Data and Alerts → Data Query to view saved current values, historical records, and trends. This page reads a storage target; it does not read the PLC again. For newly collected values, use Collection Configuration.

Configure a real-time or historical storage target first. Its forwarding group must contain the required variables, and the target must have written records.

Query historical data

  1. Open the Historical Data tab.
  2. Select the target that stores these records. Options use group name/target name.
  3. For standard history, choose numeric or string data. Use numeric data for points such as temperature and pressure.
  4. Open the time-range panel, select the start date/time and end date/time, then confirm the panel. The range must include the actual samples.
  5. Search by variable name in Variable ID and select the result; you do not need to memorize the ID.
  6. Click Refresh and check the variable, value, and collection time.

If no target is available, create and save a historical target in Data Forwarding. If a target has no records, check that it has written data before changing the query filters.

View a trend

Query one numeric variable, then switch to Chart. Change the time range and refresh to view another period. Standard historical targets provide this view; custom SQL targets display their actual columns without the same variable trend chart.

Export query results

  1. Select the target, variables, and time range, then refresh and check the results.
  2. Choose the page size and page to export. One export contains the current page, rather than all records in the time range.
  3. Click the filter bar’s downward-arrow Export action and wait for the Excel file. The chart’s image-download action does not export records.
  4. Open the file and check variables, values, and collection times. Change pages and export separately when other pages are required.

The pagination total is the number of matching records, not the number of rows in this file. Column settings change the page display without removing other exported fields.

Data Query Page

Query fields and controls

Real-time Data

Open Real-time Data, select the real-time storage target and optional variables, then refresh. Enable automatic refresh for continued observation. Pausing it freezes this page’s display. If collection values change but stored values do not, check the target and group membership.

Filters and tools

ControlDescription
Forwarding targetSelect real-time data target. Targets come from real-time data targets in data forwarding.
Variable IDMulti-selection filtering by variable ID, supports remote variable search.
Auto-RefreshAfter activation, data refreshes at set intervals, allowing pause or resume.
RefreshImmediately reload data under the current query conditions.
ExportExport real-time data under the current query conditions.
Column SettingsControl Table Column Display.

Real-time data columns

ColumnDescription
Variable NameVariable Name.
Device NameThe device name to which the variable belongs.
Variable IDUnique variable ID.
Current ValueThe current value saved in the target.
OnlineQuality saved with this record, which does not prove the device is online now.
Collection TimeVariable collection time.
Update TimeReal-time data target recording update time.

Historical Data

The Historical Data tab queries numeric values, strings, or custom SQL wide-table records.

Database Modes

The columns shown by a historical target depend on its database and physical model. Standard history tables use the common variable fields; custom SQL targets display the columns returned by the actual database table.

Database/modeQuery pathTypical columnsCustom SQL
SQL Server, MySQL, PostgreSQL, SQLite standardNumeric or string history tableDevice, variable, variable ID, value, collection time, online, record time, source epoch, source sequence, source node, and record key-
SQL Server, MySQL, PostgreSQL, SQLite customRelational wide-table pagingDefined by template ColumnsSupported
QuestDB standardNative REST SQLThe common history fields-
QuestDB customNative SQL wide tableDefined by template columnsSupported
TDengine standardNative/WebSocket queryThe common history fields-
TDengine customNative SQL wide-table queryDefined by template columnsSupported
IoTDB TreeDevice-path and measurement queryThe common history fieldsNot supported
IoTDB Table standardTIME, TAG, and FIELD table queryThe common history fields-
IoTDB Table customTable-model SQL/Tablet queryDefined by template columnsSupported

IoTDB Tree and Table are mutually exclusive physical models. Tree targets do not show the Custom SQL option; choose Table when a wide-table schema or custom statements are required.

Filters and tools

ControlDescription
Forwarding targetSelect a historical data target or custom SQL target.
Data typeA standard historical data target can query numeric or string data.
Time RangeSelect the query start and end times.
Variable IDMulti-select filter by variable ID. Custom SQL targets do not display this filter.
RefreshReload historical data.
ExportExport historical data under the current query conditions.
Column settingsA standard historical data target can control the displayed columns.

Historical data columns

ColumnDescription
TableView history in a table.
ChartA standard historical data target can switch to chart view for trend curves.
Device NameThe device name to which the variable belongs.
Variable NameVariable Name.
Variable IDUnique variable ID.
ValueHistorical record value.
Collection TimeVariable collection time.
OnlineThe online status corresponding to the history.
Creation timeHistory writing time.
Custom columnsA custom SQL target displays the target table’s columns dynamically.

Count, Sorting, and Paging

  • 50 items/page is only the current page size. The Total N indicator is the database count under the current filters.
  • Standard mode stores one row per variable. Two variables in one cycle normally produce two rows; a custom wide table normally produces one grouped row, so totals are not expected to match mechanically.
  • Sorting belongs to the current target. Switching targets clears the previous sort field and table sort state, so createTime is never sent to a wide table that only has event_time or time.
  • To inspect the newest write, sort standard history by Record time descending. To inspect collection changes, sort by Collection time descending. Custom wide tables sort by their template time column descending.
  • Paging is executed globally by the server. Cross-table count, sorting, distinct, and paging are not independently truncated per physical split table.

Time Zones

Time values fall into two categories: target storage wall-clock values and native UTC values.

Data typeDisplay rule
SQL Server, MySQL, PostgreSQL, SQLite, and TDengine standard/customStored and displayed using the target Time-zone offset, for example +08:00 displays 17:42.
IoTDB and QuestDB standardNative UTC is projected to the target time zone by the server; a +08:00 target displays 09:42Z as 17:42.
IoTDB and QuestDB wide tablesThe Z suffix is retained to make UTC explicit. Do not add eight hours manually.

If collection time and record time differ substantially, check the sampling strategy, batch writing, and target time-zone configuration, then inspect the database’s raw time column. The query page does not guess the meaning of an offset-free string from the browser time zone.

Verify the results

QueryPass standard
Real-time dataThe target, variable ID, current value, online state, and collection time match the same variable in Collection Configuration. The update time continues to change after refresh.
Historical dataRecords appear in the selected time range, collection times are in the expected order, and the table values match the trend chart.
Custom SQLThe page shows the target table’s actual columns, and key fields match the acceptance sample in the target database.
ExportThe file opens and matches the current filters and current page’s records.

Records appearing on the page only confirms that the target contains data. For acceptance, compare one known field value across the collection page, target storage, and query result.

Usage Notes

ScenariosRecommended
Target list is emptyFirst configure and enable a real-time or historical data target in “Development Configuration → Data Forwarding”.
No data on the pageCheck whether the forwarding target is running, whether the variable range includes the target variable, and whether the time range is correct.
Real-time data does not refreshCheck whether automatic refresh is paused or manually refresh.
Historical data cannot be foundConfirm that historical data targets have been written to the data, and the query time range covers the collection time.
The count is only 5050 items/page is the page size. Read the Total N indicator and check that no time range or variable filter is active.
Targets have different countsStandard mode stores one row per variable while custom wide tables group values; compare the mode and sampling strategy before comparing totals.
The newest time does not moveSort standard history by Record time descending. If the count grows while time is unchanged, inspect target and SQL logs for a query ordered by a fixed collection time.
The time is eight hours offCheck the target Time-zone offset and whether the database value ends in Z. A Z value is already UTC and must not be converted twice.
Charts do not showCharts are only applicable to general historical data targets; Custom SQL targets display only dynamic tables.
Large data outputNarrow the time range or variable range to avoid exporting too many records at once.

Troubleshooting

PhenomenonHandling Recommendations
Forwarding Target Dropdown EmptyCheck whether the data forwarding target type is real-time, historical, or custom SQL, and confirm that the target has been saved.
Variable ID cannot be found in searchConfirms the variable exists and that the current user has permission to view it.
Online state is unexpectedReturn to “Collection Configuration” or “Memory Calculation” to view the variable status and error message.
Historical curve breakpointsCheck variable collection cycles, historical data sampling strategies, network status, and target cache.
Export failureNarrow the query range and retry, then check the background logs in the system logs.