Troubleshooting
Fix unequal paths and aggregates in Ignition historian queries
Short answer
system.historian.queryAggregatedPoints pairs the paths and aggregates lists entry by entry, so len(paths) must equal len(aggregates): two tags and three aggregates must be flattened into six index-aligned pairs. On Ignition 8.3.2 and 8.3.3 that six-and-six request is reported to cross-join into 36 calculated columns plus t_stamp and tagPath, so query each pair as a singleton and key the results yourself.
On this page
- What does "The paths and aggregates lists must be the same size" mean?
- How do I build one-to-one lists for every tag and aggregate?
- Why do six paired entries return 38 columns on Ignition 8.3.2 and 8.3.3?
- Why doesn't columnNames rename the extra columns?
- What is the reliable way to query each tag-aggregate pair?
- How do I verify the results before trusting the screen?
- When can I go back to a single bulk query?
- Questions asked
The error names a binding rule, not a bad tag. system.historian.queryAggregatedPoints pairs the paths and aggregates lists entry by entry, so both must carry the same number of items: two tag paths against three aggregate functions fails validation with "The paths and aggregates lists must be the same size" before a single sample is read. Flattening the call to six index-aligned pairs satisfies that contract, but on Ignition 8.3.2 and 8.3.3 the CALCULATION return format cross-joins the two six-item lists into 36 calculated columns plus t_stamp and tagPath, and ignores columnNames. On those builds, query each tag-and-aggregate pair as a singleton and key the results yourself.
What does "The paths and aggregates lists must be the same size" mean? #
It means the two arguments are index-paired: entry zero of paths is calculated with entry zero of aggregates, entry one with entry one, so the lists must be equal length and two paths against three aggregates fails validation before any history is queried.
The function reference in the Ignition User Manual describes paths as a list of strings, one tag path per calculation, with aggregates supplied alongside it. The other arguments in play:
paths— identifies the history tag for each calculationaggregates— the calculation applied to the path at the same indexreturnFormat='CALCULATION'— requests calculated result columnscolumnNames— supplies aliases only; it neither defines nor reduces the number of calculations
The message is a complaint about cardinality, not about either tag path. [TEST]Tag_1 and [TEST]Tag_2 can both hold good history and the call still fails, because 2 does not equal 3. Check len(paths) == len(aggregates) before the call and the message disappears.
How do I build one-to-one lists for every tag and aggregate? #
Expand the cross product yourself: for two tags and three aggregates, both lists become six index-aligned entries — 2 × 3 = 6 pairs — each tag repeated once per aggregate and each aggregate repeated once per tag.
tags = ['[TEST]Tag_1', '[TEST]Tag_2'] # example paths, list of str
aggregates = ['Minimum', 'Maximum', 'Average'] # list of str
tagList = [tag for tag in tags for _ in aggregates]
aggregateList = aggregates * len(tags)
nameList = ['%s.%s' % (tag, aggregate) for tag in tags for aggregate in aggregates]
print len(tagList), len(aggregateList), len(nameList) # 6 6 6
The six pairs, in submission order:
| Index | paths entry |
aggregates entry |
Alias |
|---|---|---|---|
| 0 | [TEST]Tag_1 |
Minimum |
[TEST]Tag_1.Minimum |
| 1 | [TEST]Tag_1 |
Maximum |
[TEST]Tag_1.Maximum |
| 2 | [TEST]Tag_1 |
Average |
[TEST]Tag_1.Average |
| 3 | [TEST]Tag_2 |
Minimum |
[TEST]Tag_2.Minimum |
| 4 | [TEST]Tag_2 |
Maximum |
[TEST]Tag_2.Maximum |
| 5 | [TEST]Tag_2 |
Average |
[TEST]Tag_2.Average |
Inspect the pairs with print zip(tagList, aggregateList) before executing the historian call; you should see exactly the six rows above.
Why do six paired entries return 38 columns on Ignition 8.3.2 and 8.3.3? #
Because the CALCULATION return path reported on those builds cross-joins the expanded lists: 6 paths × 6 aggregates = 36 calculated columns, and t_stamp and tagPath make the 38 that came back.
The arithmetic, using the lists from the previous section:
- Flattened list length: 2 tags × 3 aggregates = 6 entries per list
- Calculated columns returned: 6 × 6 = 36
- Total dataset width: 36 +
t_stamp+tagPath= 38 columns
A correct bulk result carries one column per requested pair: 6 calculations + 2 = 8 columns. The reported expansion rule is len(paths) × len(aggregates) calculated columns; the same report shows a direct three-and-three call returning 3 × 3 = 9 calculated columns, so whatever list lengths you submit get multiplied. The behavior was reported against 8.3.2 and seen again on 8.3.3, and one flattened query with a column count proves it on your build.
| Request | paths |
aggregates |
Result on 8.3.2 / 8.3.3 |
|---|---|---|---|
| Direct cross product | 2 | 3 | Validation error: lists must be the same size |
| Flattened pairs | 6 | 6 | 6 × 6 = 36 calculated columns + 2 = 38 columns |
| Singleton query | 1 | 1 | 1 calculated column + 2 = 3 columns |
The decision for 8.3.2 and 8.3.3: do not put a multi-pair CALCULATION query into production.
Why doesn't columnNames rename the extra columns? #
columnNames supplies aliases at the end of the pipeline; it cannot collapse a cross-joined schema, and in the 8.3.3 report the aliases were not applied at all, so six names never reach 38 columns.
Aliases are cosmetic. Six names applied to a dataset that already holds 38 columns would still leave 32 duplicate calculations underneath, and on the 8.3.3 report the dataset came back with default names regardless. The fix is the same either way: key your own dictionary with '%s.%s' % (tag, aggregate), bind every display field to that key, and treat returned column names as untrusted on these builds.
What is the reliable way to query each tag-aggregate pair? #
Issue one call per pair with singleton lists — paths=[tag], aggregates=[aggregate] — which satisfies the one-to-one contract and never hands the affected expansion path more than a single pair to multiply.
tags = ['[TEST]Tag_1', '[TEST]Tag_2'] # example paths, list of str
aggregates = ['Minimum', 'Maximum', 'Average'] # list of str
endTime = system.date.now()
startTime = system.date.addDays(endTime, -30)
results = {}
for tag in tags:
for aggregate in aggregates:
name = '%s.%s' % (tag, aggregate)
results[name] = system.historian.queryAggregatedPoints(
paths=[tag],
startTime=startTime,
endTime=endTime,
aggregates=[aggregate],
returnFormat='CALCULATION')
print len(results) # 6
Each result carries exactly one calculation, so the tag-and-aggregate identity of every value is guaranteed by the call itself, and the alias in results preserves that identity even where columnNames is ignored. Six separate scans of a dense 30-day window cost more than one; when the window is the problem, downsampling old Ignition historian data to one-minute averages shortens each scan, at the price of exact minima and maxima over the raw samples.
How do I verify the results before trusting the screen? #
Check six unique keys over one shared 30-day window, three columns per singleton dataset — one calculation plus t_stamp and tagPath — and Minimum ≤ Average ≤ Maximum for each tag before binding any value to the display.
- Record the one
startTimeandendTimepair used by all six queries; a mismatched window is the first thing to rule out when two displays disagree. - Confirm
resultsholds six unique keys: three for[TEST]Tag_1, three for[TEST]Tag_2. - Count the columns of one returned dataset: one calculation plus
t_stampandtagPathmakes three; more than three means the call was not a singleton. - Over the same stored samples, check Minimum ≤ Average ≤ Maximum per tag; a violation means values are mixed between tags or aggregates, not that the arithmetic is wrong.
- If a value is wrong, work outward from storage: confirm the path has samples inside the window first — live data with empty history is a logging fault, the split covered in why Ignition historian tags stopped recording but live data is good — then the live tag's value and quality, and only then the driver and controller behind it.
When can I go back to a single bulk query? #
When a flattened test query on your current build returns 8 columns for six pairs — 6 calculations plus t_stamp and tagPath — the expansion is gone and one bulk CALCULATION call is safe; 38 columns keeps the singletons in place.
The test is cheap: after any Ignition upgrade, run the six-and-six flattened query from the second section once in a script console and count the columns. Note the result in your upgrade record so the next engineer knows why the loop exists. If you also depend on columnNames, rerun the alias check in the same pass, since the two behaviors were reported together but may not be fixed together.
Questions asked
Does system.tag.queryTagHistory have the same list-pairing rule?
No. queryTagHistory applies a single aggregation mode to every path in the call, so there is no per-path aggregate list to pair. Request Minimum, Maximum and Average as three calls over identical start and end times, then assemble the values in your own dictionary the same way.
Why capture endTime once, outside the loop?
Because system.date.now() returns a new timestamp on every call. Captured inside the loop, six nominally identical 30-day windows would each differ by milliseconds, and a sample landing in that gap changes one aggregate with no visible code difference. One captured timestamp makes all six windows identical, which is what makes the values comparable.
Does the cross-join affect returnFormat values other than CALCULATION?
The reported cases cover returnFormat='CALCULATION' on Ignition 8.3.2 and 8.3.3; other formats are untested here. Before trusting any other format with multiple pairs, run one two-tag, three-aggregate request and count the returned columns against the six calculations you asked for.
Is scripting the only way to put these aggregates in a report?
No. The Reporting module's tag calculation query data source runs aggregates against tag history without script and is the supported path when the numbers are destined for a report page. Keep the singleton pattern for screens, gateway timers and anywhere else you call the historian directly.