Skip to main content

Data Query

Data query is used to view data written to GatewayRuntime as real-time data targets (stored as current values) and historical data targets (stored by time). The page is divided into tabs "Real-time Data" and "Historical Data," suitable for operations and maintenance personnel to confirm collected values, forward inventory results, and historical trends.

First Look at Terms

TermsOn-site Understanding
Real-time data targetThe storage target for each variable's latest value, similar to a current-value table.
Historical data targetA target that records variable values over time for trends, traceability, and export.
Custom SQL wide tableA history table whose columns are defined for the project rather than using the standard variable columns.
Forwarding targetThe place where data is written. Data Query reads from the forwarding target; it does not read the PLC again.
Variable IDThe unique number of the variable within the system. After renaming variables, IDs can still be used for precise filtering.
Collection time / update timeCollection time is when the gateway obtains the variable value. Update time is when the target record is written or updated.

Function Entry

After logging into GatewayRuntime Web, click the menu on the left "Data and Alerts → Data Query".

Data Query Page

Page Structure

TabsDescription
Real-time DataQuery the current variable value in the real-time data objective.
Historical DataQuery historical data objectives or custom history in SQL wide tables, with support for table and chart views.

The real-time and historical targets come from the corresponding targets configured in Data Forwarding. If no target is configured or the target has not written data, the page shows “No data”.

Confirmation Before Querying

The data query page views "data already written by the data forwarding target," not directly re-read from the PLC. If no data can be found on site, first confirm that the data link is open before determining the query conditions.

ChecklistDescription
Collection sideThe variable has its current value in "Collection Configuration" or "Memory Calculation" and is normal.
Forwarding sideA real-time data, historical data, or custom SQL target is configured, enabled, and online.
Variable RangeThe data forwarding group contains the variables to be queried; online filtering and sampling strategies do not exclude the data.
Time RangeThe start and end times of historical queries cover the collection time, and confirm that the gateway time synchronization is normal.
PermissionsThe current account has data query, export, and target access permissions.

Real-time Data

The Real-time Data tab queries the current records in a real-time data target.

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.
OnlineShows whether the variable is online.
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 objectives 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.

Query Steps

  1. Go to "Data and Alerts → Data Query".
  2. Switch between the "Live Data" or "Historical Data" tabs as needed.
  3. Select the forwarding target.
  4. Real-time data can select variable IDs and enable automatic refresh; Historical data should be selected by time range, data type, and variable ID.
  5. Click Refresh to view the results.
  6. Click Export when archiving is needed.

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 exported file opens and matches the current filters, variable range, and time range.

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 objectives; Custom SQL goals 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.