# Ignition Logging, Reporting, and Trending Options

**URL:** <https://forum.inductiveautomation.com/t/ignition-logging-reporting-and-trending-options/59811>\
**Category:** Ignition\
**Tags:** ignition81, database\
**Created:** [May 19, 2022, 9:18pm UTC](https://forum.inductiveautomation.com/t/ignition-logging-reporting-and-trending-options/59811 "2022-05-19T21:18:38Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [May 19, 2022, 9:18pm UTC](https://forum.inductiveautomation.com/t/ignition-logging-reporting-and-trending-options/59811/1 "2022-05-19T21:18:38Z")

</div>

Looking at reporting options.

With FTV SE we usually create external reports using SSMS with the SQL Express DB that we log tags to for trending.

1. Is any reporting available at all through Ignition without the Reporting Module?

2. Is there a way to pull the data out of the internal database and more-or-less copy the data into our own SQL Express DB (or use it directly) to do the same (i.e. make external reports)?

3. Is either the Tag Historian or SQL Bridge module _required_ to get data into an external database, or is there some other way to access this data?

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [May 19, 2022, 9:31pm UTC](https://forum.inductiveautomation.com/t/ignition-logging-reporting-and-trending-options/59811/2 "2022-05-19T21:31:26Z")

</div>

First, you do not need the SQL Bridge or Historian modules to query data. You can kind of fake a report using the tools available in vision or perspective, but it will be limited. I don’t know about messing with the internal database, but you can query a database and then insert that data into another database.

Check out system.db, very powerful tools.  
[https://docs.inductiveautomation.com/display/DOC81/system.db](https://docs.inductiveautomation.com/display/DOC81/system.db)

---

<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:** [May 19, 2022, 9:42pm UTC](https://forum.inductiveautomation.com/t/ignition-logging-reporting-and-trending-options/59811/3 "2022-05-19T21:42:34Z")

</div>

> [@amarks](#):
>
> Is either the Tag Historian or SQL Bridge module _required_ to get data into an external database, or is there some other way to access this data?

Database actions can be entirely scripted without those modules. Trending also becomes very manual. No Perspective Power Chart, no tag pens in Vision's EasyChart.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [May 19, 2022, 9:55pm UTC](https://forum.inductiveautomation.com/t/ignition-logging-reporting-and-trending-options/59811/4 "2022-05-19T21:55:30Z")

</div>

Does the internal Tag Historian not work for trending?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 19, 2022, 10:07pm UTC](https://forum.inductiveautomation.com/t/ignition-logging-reporting-and-trending-options/59811/5 "2022-05-19T22:07:25Z")

</div>

Despite the name, the “internal historian” does not actually store data inside Ignition’s internal DB. Also, it requires the tag historian module.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [May 20, 2022, 1:18pm UTC](https://forum.inductiveautomation.com/t/ignition-logging-reporting-and-trending-options/59811/6 "2022-05-20T13:18:09Z")

</div>

Is there documentation for database actions and trending without Tag Historian? (using Vision)

---

<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:** [May 20, 2022, 1:35pm UTC](https://forum.inductiveautomation.com/t/ignition-logging-reporting-and-trending-options/59811/7 "2022-05-20T13:35:28Z")

</div>

Start with @josborn’s link.

Then this for bindings (among others):

[https://docs.inductiveautomation.com/display/DOC81/Named+Query+Bindings](https://docs.inductiveautomation.com/display/DOC81/Named+Query+Bindings)

Then this for charting, keeping in mind that you cannot use tag historian bindings nor EasyChart tag pens:

[https://docs.inductiveautomation.com/display/DOC81/Vision+-+Charts+Palette](https://docs.inductiveautomation.com/display/DOC81/Vision+-+Charts+Palette)

Consider also going through Inductive University.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [May 20, 2022, 1:39pm UTC](https://forum.inductiveautomation.com/t/ignition-logging-reporting-and-trending-options/59811/8 "2022-05-20T13:39:11Z")

</div>

Thanks. This looks like everything I would need.  
I have gone through Inductive University and have both Core and Gold certificates.

I noticed that you mentioned creating your own module in another post asking questions about similar topics. I’ve not looked into anything about creating a module. Could you point me in the right direction to start looking into that?

---

<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:** [May 20, 2022, 1:42pm UTC](https://forum.inductiveautomation.com/t/ignition-logging-reporting-and-trending-options/59811/9 "2022-05-20T13:42:55Z")

</div>

Brace yourself. Start here:

> **[Module Development](https://forum.inductiveautomation.com/c/module-development/7)**
>
> Discussion about developing Ignition Modules using the Ignition Module SDK.

Then follow the SDK link near the bottom of the sidebar of the online docs. Follow IA’s github repos.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 20, 2022, 2:29pm UTC](https://forum.inductiveautomation.com/t/ignition-logging-reporting-and-trending-options/59811/10 "2022-05-20T14:29:29Z")

</div>

A somewhat rambling primer to the concepts, if you're not familiar with Java development:

> [@I am looking for a tutor for module development](https://forum.inductiveautomation.com/t/i-am-looking-for-a-tutor-for-module-development/55030/4):
>
> Nah, you’re fine. We have occasional job posts/job seekers as well; I think as long as they’re not inundating the forum it’s not a big deal. I think at least part of the confusion for people who might be familiar with programming, but struggle to get started with module development, is that you’re learning two separate things at the same time. There’s a particular Java build stack (whether you choose Maven or Gradle or whatever), and then attached to it the Ignition API surface, which is fair…

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [May 20, 2022, 4:07pm UTC](https://forum.inductiveautomation.com/t/ignition-logging-reporting-and-trending-options/59811/11 "2022-05-20T16:07:46Z")

</div>

> [@paul-griffith](#):
>
> Despite the name, the "internal historian" does not actually store data inside Ignition's internal DB. Also, it requires the tag historian module.

Am I able to use the Database Connection defined in the gateway configuration page without a specific module? (i.e. I want to make a query tag and need a datasource)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 20, 2022, 4:11pm UTC](https://forum.inductiveautomation.com/t/ignition-logging-reporting-and-trending-options/59811/12 "2022-05-20T16:11:34Z")

</div>

Yes. “Raw” database connections, and their use through scripting (`system.db` functions), and named queries, are all “platform” features.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [May 20, 2022, 9:05pm UTC](https://forum.inductiveautomation.com/t/ignition-logging-reporting-and-trending-options/59811/13 "2022-05-20T21:05:47Z")

</div>

> [@josborn](#):
>
> Check out system.db, very powerful tools.  
> [system.db - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.db)

> [@pturmel](#):
>
> Start with @josborn's link.
> 
> Then this for bindings (among others):
> 
> [Named Query Bindings - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/Named+Query+Bindings)
> 
> Then this for charting, keeping in mind that you cannot use tag historian bindings nor EasyChart tag pens:
> 
> [Vision - Charts Palette - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/Vision+-+Charts+Palette)
> 
> Consider also going through Inductive University.

Ok, so I think I understand what I need to do.  
Getting data out of Ignition and into an external database isn't too hard. Instead of configuring Tag History for each tag I'll use a Tag Change script and use scripting to log it into the database.

Then, to do trending I'll need to pull from this database.  
Historical trending seems relatively straightforward, however I'm having trouble thinking about how to handle queries for realtime trends. Any insights?

---

<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:** [May 21, 2022, 1:22am UTC](https://forum.inductiveautomation.com/t/ignition-logging-reporting-and-trending-options/59811/14 "2022-05-21T01:22:21Z")

</div>

You just re-run the query that has bounds including now() every so often (the easy chart typically queries once per second). Note, you **can** use the EasyChart’s DB pens.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [June 6, 2022, 6:49pm UTC](https://forum.inductiveautomation.com/t/ignition-logging-reporting-and-trending-options/59811/15 "2022-06-06T18:49:38Z")

</div>

In the end it turned out not to be so bad doing data logging and trending without the tag historian module.

1. Create a DB and table using MS SQL Express (or your preferred DB)
2. Add DB connection to the gateway
3. Set default DB for the project
4. Create 3 named queries for call in scripting (`system.db.runNamedQuery()`)  
a. Create the table if it does not already exist in the DB (gateway called via gateway startup script)  
b. Get the latest tag value from the DB  
c. Store new tag value to the DB
5. Add gateway startup script to call named query 4a
6. Add project as Gateway Scripting Project  
a. Define logging script in Gateway Scripting Project
7. Add tag event value changed script to tags of interest (ideally, apply to UDT(s))  
a. I added custom properties to enable/disable logging and an adjustable deadband  
b. I strip out the PLC tag from the OPC item path for use as the “tag id” in the DB  
c. Check the current value vs the latest value in the DB and update DB as required
8. Create an easy chart and use DB pens instead of tag pens  
a. Use the where clause to match to the PLC tag
