Integrating LGH File Inspector via InTouch Scripting

4 min read

Apr 28, 2022 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 being able to easily access that historical data is key for making important decisions.

LGH File Inspector enables scalable, fast access to local daily historical data files (*.lgh files) logged by AVEVA InTouch HMI and SCADA applications without the limitations imposed by other solutions.

In this blog post, we'll cover how to seamlessly integrate LGH File Inspector with InTouch using InTouch scripting using two different methods.

With local history data stored by AVEVA InTouch™ in LGH files, LGH File Inspector is a flexible third-party option for querying that InTouch history data for report generation and other uses cases. For those InTouch users that prefer a more integrated user experience, though, it's possible to interact with LGH File Inspector directly from your InTouch applications via InTouch scripting.

The following are two different examples of how to use InTouch scripting to integrate LGH File Inspector:

Integrating LGH File Inspector with an InTouch Button Action Script

  1. First, an LGH File Inspector Query has to be configured in the Advanced Query Settings window.

    Screenshot_LGH_File_Inspector_Advnaced_Query_Settings

    1. The Variable Query Begin Date and Time Date is configured to set the query’s beginning time by starting with an Initial Date of the First Day of Year (STEP 1), and then subtracting units of time (STEP 2) from the Initial Date to arrive at 2/10/2016 2:00:00 AM.
    2. The query’s Destination Options are configured to Update an existing Worksheet in an existing Workbook and then show the Workbook to the user.
  2. The time span (Duration) of the query is configured in the Query Settings slide out of the Application Window. In the picture below, we show that the Query Duration will be 1 Hour and the Query Interval for evenly spaced data will be 1-minute apart.

    Screenshot_LGH_File_Inspector_Query_Settings

    So, when this query runs, it will run beginning at 2/10/2016 2:00:00 AM and ending at 2/10/2016 3:00:00 AM. The query results will be placed in the Data Sheet of an existing Excel Workbook located at: C:\Users\{User}\Desktop\Report_from_LGHFI.xlsx. The Workbook will be shown to the user. The query configuration is saved to an LGH File Inspector file type in: C:\Users\{User}\Desktop\LGHQuery4.lghq.
  3. Next, an InTouch application needs to be configured with a Button with a Touch Action Script with a single line of code as shown in the following picture. 

    Screenshot_LGH_File_Inspector_InTouch_Button_Action_Script

Now, when the user clicks the Button on the display, the script will run and will open the LGH File Inspector query file which will then run the previously defined query and present the Excel workbook with query results to the user.

Integrating LGH File Inspector with an InTouch Condition Script

The next method is integration via a conditional script in InTouch, where the same action as the button script is performed but based on a defined condition. In this example, that condition is based on the value of an item.

  1. The first step, as with the previous method, is first configuring the LGH File Inspector query which is configured similarly to the query in the previous example, except that it’s Query Destination is configured to Create a new Workbook, Save and then Close. The filename of the new Workbook is also configured to include the Query beginning time in the filename so that a unique file is created each time the query is run.

    Screenshot_LGH_File_Inspector_Advanced_Query_New_Workbook_Hourly

    The net result of this type of configuration would be a new Excel workbook with 1-hour of data created hourly.
  2. Next, in the InTouch application, you need to configure a Condition Script such that when the value of "tag1" changes to 20 (Tag==20), InTouch will open an LGH File Inspector Query called LGHQuery5.lghq.

    Screenshot_LGH_File_Inspector_InTouch_Condition_Script

So these examples were just two types of InTouch script but any script type can accomplish similar functionality and integrate LGH File Inspector functionality seamlessly. For full details on what scripting capabilities are supported in AVEVA InTouch, please consult the InTouch documentation.

Being able to quickly and cost-effectively access historical process data for decision making can provide significant benefits for an enterprise. If your InTouch history data is just sitting there and you’d like a quick and easy method of accessing it that can be integrate with your InTouch applications, I encourage you to download a free trial of LGH File Inspector and try for yourself.

Click to Download LGH File Inspector

Kevin Rutherford
Written by Kevin Rutherford

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