# Tag group history, one shot and double-history

**URL:** <https://forum.inductiveautomation.com/t/tag-group-history-one-shot-and-double-history/56882>\
**Category:** Ignition\
**Created:** [March 5, 2022, 10:39am UTC](https://forum.inductiveautomation.com/t/tag-group-history-one-shot-and-double-history/56882 "2022-03-05T10:39:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [March 5, 2022, 10:39am UTC](https://forum.inductiveautomation.com/t/tag-group-history-one-shot-and-double-history/56882/1 "2022-03-05T10:39:50Z")

</div>

I’m building a plant dashboard and need to get production counts by shift. There are multiple shift patterns but they all start on the hour or at half-past. I reckon that the simplest way to get a responsive dashboard would be to record each machine’s count every 30 minutes into a dedicated historian table.

I’ve created a tag group for this.

 ![30 minute tag group](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/6/d6f4e977282f49edd9f97e5d7abc05821381a917.png)

The driving expression is

```auto
(dateExtract(now(1000), "minute") = 0) || (dateExtract(now(1000), "minute") = 30)

```

and _One Shot_ is set to true. I’m expecting it to fire once every 30 minutes.

To speed up development I have it firing at 0, 5, 10, 15, etc. and am seeing some double records within the same minute.

```auto
# tagid, intvalue, floatvalue, stringvalue, datevalue, dataintegrity, t_stamp, from_unixtime(t_stamp/1000)
'2', '17866883', NULL, NULL, NULL, '192', '1646475001333', '2022-03-05 10:10:01.3330'
'2', '17866895', NULL, NULL, NULL, '192', '1646475056386', '2022-03-05 10:10:56.3860'

'2', '17866945', NULL, NULL, NULL, '192', '1646475301683', '2022-03-05 10:15:01.6830'
'2', '17866957', NULL, NULL, NULL, '192', '1646475357737', '2022-03-05 10:15:57.7370'

'2', '17867120', NULL, NULL, NULL, '192', '1646476201958', '2022-03-05 10:30:01.9580'
'2', '17867132', NULL, NULL, NULL, '192', '1646476259013', '2022-03-05 10:30:59.0130'

'2', '17867181', NULL, NULL, NULL, '192', '1646476501299', '2022-03-05 10:35:01.2990'

```

Questions:

1. What’s wrong with my tag group configuration.
2. Is there a better strategy?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 5, 2022, 2:52pm UTC](https://forum.inductiveautomation.com/t/tag-group-history-one-shot-and-double-history/56882/2 "2022-03-05T14:52:31Z")

</div>

This is a job for a scheduled transaction group or a scheduled event. The tag historian is not really made to do synchronized snapshots, IMNSHO. Square peg, round hole.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [March 6, 2022, 3:15pm UTC](https://forum.inductiveautomation.com/t/tag-group-history-one-shot-and-double-history/56882/3 "2022-03-06T15:15:55Z")

</div>

Thanks, Phil. That was the direction I needed to go and get a grip on _Transaction Manager_.

I plan to retrieve the record for the time in question and allow for the couple of seconds t\_stamp error as follows:

```auto
SELECT t_stamp , {columnName} AS count
FROM manf_dashboard_summary
WHERE t_stamp >= :timestamp
LIMIT 1

```

The `{columnName}` querystring will be generated by the script so I’m not concerned about SQL injection.

Does that look like a reasonable approach?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 6, 2022, 5:35pm UTC](https://forum.inductiveautomation.com/t/tag-group-history-one-shot-and-double-history/56882/4 "2022-03-06T17:35:31Z")

</div>

Meh. I would use a wide table. I would use OPC Read mode on your transaction group to ensure data is sampled after the trigger change. (Or `system.opc.read*()` in your scheduled script.)

Related discussions:

[https://forum.inductiveautomation.com/search?q=historian%20tables%20tall%20wide](https://forum.inductiveautomation.com/search?q=historian%20tables%20tall%20wide)
