# Expected return format for MinMax aggregate using a Custom History Provider?

**URL:** <https://forum.inductiveautomation.com/t/expected-return-format-for-minmax-aggregate-using-a-custom-history-provider/108239>\
**Category:** Module Development\
**Created:** [July 8, 2025, 4:14pm UTC](https://forum.inductiveautomation.com/t/expected-return-format-for-minmax-aggregate-using-a-custom-history-provider/108239 "2025-07-08T16:14:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrew.jank](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@andrew.jank](https://forum.inductiveautomation.com/u/andrew.jank)\
**Post date:** [July 8, 2025, 4:14pm UTC](https://forum.inductiveautomation.com/t/expected-return-format-for-minmax-aggregate-using-a-custom-history-provider/108239/1 "2025-07-08T16:14:16Z")

</div>

I am trying to implement a Custom History Provider. I cannot get the correct values (1 for each) to return in MinMax when displaying the data to a chart or a table.

Expected: (using SQL Lite historian)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/4/5467980c493533580a90f64f75d5f6edd2a37759.png)

Actual: (My History Provider)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/3/735b19cd874da9d6c702dcd4ef6cd26a5c81ceba.png)

Code:  
Essentially what I am doing is adding the Minimum aggregate then the Maximum aggregate to the history column

```python
        for (var entrySet : tagConfigByTagId.entrySet()){
            var values = valuesByTag.get(entrySet.getKey());
            if (values != null){
                var tagConfig = entrySet.getValue();
                var column = columnNodesByName.get(tagConfig.getPath().toStringFull());
                if (column instanceof ProcessedHistoryColumn){
                    List<QualifiedValue> qualifiedValues = new ArrayList<>();
                    for (var aggregateValues : values.getAggregates().values()){
                        for (var value : aggregateValues.getValues()){
                            qualifiedValues.add(new BasicQualifiedValue(value.getValue(), QualityCode.getQualityFor(value.getOpcQuality()), Utility.FormatAsLocalDate(value.getUtcTimestamp())));
                        }
                    }
                    ((ProcessedHistoryColumn)column).put(qualifiedValues);
                }
            }
        }

```

---

<div class="post-metadata">

**Author:** ![robertm](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@robertm](https://forum.inductiveautomation.com/u/robertm)\
**Post date:** [July 8, 2025, 5:05pm UTC](https://forum.inductiveautomation.com/t/expected-return-format-for-minmax-aggregate-using-a-custom-history-provider/108239/2 "2025-07-08T17:05:59Z")

</div>

Your time span is 7 hours different?

---

<div class="post-metadata">

**Author:** ![andrew.jank](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@andrew.jank](https://forum.inductiveautomation.com/u/andrew.jank)\
**Post date:** [July 8, 2025, 5:18pm UTC](https://forum.inductiveautomation.com/t/expected-return-format-for-minmax-aggregate-using-a-custom-history-provider/108239/3 "2025-07-08T17:18:53Z")

</div>

This is just an example to demonstrate what I am looking for. I'd expect to see 2 values (1 for min, 1 for max) for each timestamp. The actual timestamp and the value are irrelevant in this case.

---

<div class="post-metadata">

**Author:** ![robertm](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@robertm](https://forum.inductiveautomation.com/u/robertm)\
**Post date:** [July 8, 2025, 6:51pm UTC](https://forum.inductiveautomation.com/t/expected-return-format-for-minmax-aggregate-using-a-custom-history-provider/108239/4 "2025-07-08T18:51:14Z")

</div>

It does matter. Min/Max only returns a single row if it didnt change in the time span. Probably not your issue, but apples to apples data comparison might help identify a problem.

---

<div class="post-metadata">

**Author:** ![andrew.jank](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@andrew.jank](https://forum.inductiveautomation.com/u/andrew.jank)\
**Post date:** [July 8, 2025, 6:59pm UTC](https://forum.inductiveautomation.com/t/expected-return-format-for-minmax-aggregate-using-a-custom-history-provider/108239/5 "2025-07-08T18:59:39Z")

</div>

I understand that for the SQL Lite historian. This does not apply to my historian which will return a value for the interval regardless of if there is data or not. I'm pretty sure that the issue is with how I am adding the data to the column in HistoryQueryExecutor.

---

<div class="post-metadata">

**Author:** ![andrew.jank](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@andrew.jank](https://forum.inductiveautomation.com/u/andrew.jank)\
**Post date:** [July 29, 2025, 4:19pm UTC](https://forum.inductiveautomation.com/t/expected-return-format-for-minmax-aggregate-using-a-custom-history-provider/108239/6 "2025-07-29T16:19:29Z")

</div>

Bumping this thread for more visibility now that 8.3 beta has been released and more eyes on the forums

---

<div class="post-metadata">

**Author:** ![andrew.jank](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@andrew.jank](https://forum.inductiveautomation.com/u/andrew.jank)\
**Post date:** [August 1, 2025, 6:50pm UTC](https://forum.inductiveautomation.com/t/expected-return-format-for-minmax-aggregate-using-a-custom-history-provider/108239/7 "2025-08-01T18:50:41Z")

</div>

See implementation here:

> [@How to store MinMax aggregate values as QualifiedValues in ProcessedHistoryColumn?](https://forum.inductiveautomation.com/t/how-to-store-minmax-aggregate-values-as-qualifiedvalues-in-processedhistorycolumn/109099/2):
>
> I figured it out. I had to create my own History Node using decompiled versions of DefaultHistoryColumn and ProcessedHistoryColumn. ProcessedHistoryColumn does not work for MinMax and cannot be used. I created the following column to be used for MinMax and the standard case of 1 value per column. import com.inductiveautomation.ignition.common.TypeUtilities; import com.inductiveautomation.ignition.common.model.values.BasicQualifiedValue; import com.inductiveautomation.ignition.common.model.val…
