Extracting InTouch History Data (LGH) Made Easy

4 min read

Oct 11, 2016 2:00:00 PM

A key feature of any HMI package is the ability to not only show the current state of your control system, but to then store that information for historic purposes. But what good is historical data when you can’t easily access it? How can historical data result in process improvements, financial returns, or increases in efficiency if you’re not accessing it?

With Wonderware InTouch LGH files, this data can now not only be accessed easily, but can be automated such that report generation is setup once, and then you’re finished.   In this blog, I will show you how you can easily automate your report generation - in less time than it will probably take you to read the rest of this blog.

  1. The first time you open the LGH File Inspector you will need to specify the directory that holds the LGH Files you would like to query.

The LGH File Inspector will automatically query the latest LGH File to determine all tags that were stored in the file.

Selecting LGH File Directory

  1. We are going to ignore the “Set Query Time” box for now, and jump right down to “STEP 2: Select Tags to Query”. From the list of available tags, select any tags that should be included in this automated query – click and drag them to the “Tags in this Query” box.

Multiple tags can be selected at once by using CTRL + Select or SHIFT + Select, and the Search Box can be used to narrow down the number of tags that are displayed.

Selecting Tags for the LGH File Query

  1. Use the Advanced button at the top of your Window to configure the behavior when this query is called by another application.

Specify an Initial Date and Time offset. As an example – running an hourly report that should export all values for the last hour could be set up with an initial Date of “This Hour” and subtracting an Hour:

Defining Query Date and Frequency Settings

This will also be where we can specify the destination of our export file, and whether a new report should be generated every time, or if the data should be added to an existing report. In this case, I want to save each report to a new CSV File and append the time to my base file name:

Specifying Destination of Query Results

  1. Let’s Save and Close these settings. We can now set the Query Duration and Query Interval. For my hourly report, I will set the Query Duration to 1 Hour (any higher, and we would be attempting to report on future data such that these fields would be expected to show blank values in our report), and I want my report to show the value in 10 second increments.

Setting Query Duration and Interval

The Query Begin Time and Date can be ignored on this screen, since we have already set these in the Advanced settings.

  1. Use the Save As Dialog to give your report a descriptive name, and save it to your Computer.

Saving the Automated Query

This creates an .lghq file, that can be run to generate the report that was just configured, but manually having to double click the file is not very automated, and isn’t very efficient at all. So our next step is to create a Scheduled task, using the Windows Task Scheduler, to run our query at a regular interval automatically.

  1. Open the Windows Task Scheduler and create a new task.

Using Windows Task Scheduler

  1. Give the task a descriptive name.

Naming A New Windows Task

  1. On the Triggers tab, use the New button to create a new trigger condition for our report, and set the start time, interval, and end time (if there is one).

Creating a New Schedule Trigger

  1. Use the New button to create a new action for the Scheduled task and configure it to launch the LGH File inspector, and pass the lghq query file that was created earlier as an argument.

Defining a New Scheduled Action

At this point we’re done; we have configured a query that will generate a report from our LGH files, and we have configured the Scheduled Task that will be driving our report generation.

Being able to quickly and cost-effectively access historical process data can generate substantial benefits for an enterprise. If you’re InTouch history data is just sitting there and you’d like a quick and easy method of accessing it, I encourage you to download a free trial of LGH File Inspector and try for yourself.

Click to Download LGH File Inspector

Topics: Wonderware LGH

Marc Holbach
Written by Marc Holbach

Software Toolbox Technical Blog

We're engineers like you, so this blog focuses on "How to" appnotes, videos, tech team tips, product update announcements, user case studies, and other technical updates.  Subscribe to updates below. Your feedback and questions on posts are always welcomed - just use the area at the bottom of any post.

Subscribe to our Blog

Recent Posts

Posts by Topic

See all