Writing an event-based script to execute bifurcation of data logging of every 24-hour period

I have 2 boolean tags which act as pointers to sort my data log into 2 sections every 24 hours; GGBS & OPC.
When GGBS boolean tags goes high, my data should log into table A & when OPC boolean tag goes high, same data should log into table B. These separate logs will then populate my Report excelsheet in 2 separate columns. The excelsheet representation will look like this for 24-hour period:-

Basically, my aim is to sort data logged for 24-hour period into 2 columns; i.e. if a particular process tag runs for 19hrs in GGBS & 5 hrs in OPC, it should correspondingly populate the 19 hour data into GGBS column & 5 hour data into OPC column for that particular process tag. I desire to achieve it in the software itself so that Reporting becomes easier & simpler to extrapolate.

If your purpose is to write a script that update an Excel template ( for example: you have your Excel file, something like “Report.xls” composed as the picture shows and you want to put data in it ), I’m sorry to inform you that it seems impossible for now since Igntion’s system functions ( I’m talking about “system.” functions ) can’t let you modify an already existing file, only generate a new one every time but you CAN’T specify the position of where to put the data also.
Even with external Python’s libraries this is not possible because the current Ignition’s scripting version is Jython 2.5.
The only solution I found is to use “xslxwriter” library ( working with Python 2.5 ). This module WILL NOT let you modify an already existent file but at least you can specify where you want to put the data. The documentation is well written and it’s easy to use even if you are not familiar with Python or scripting in general.

If you read my question, I want to bifurcate my data into SQL database table & not directly into Excelsheet. I’m aware Ignition doesn’t directly support Excel format.
That image was a reference for your understanding as to what I wanna achieve out of bifurcating the datalog.
Extrapolation in my Excel Report is going to remain via SQL only,
I require help writing an event-based script which will sort the tag values as per status of those 2 boolean tags into 2 separate MySQL database table columns!
If you could assist in this, it will be helpful. :slight_smile:

If I understood correctly you just want to insert data into an SQL table when a boolen tag raise up.
Well if this is the case you have just to:
-From the “Project Browser” expands “Scripts” and click on “Gateway Events Scripts”
-Select “Tag Change”, click on the "add tag " icon

  • a new script will pop up called " New Script "
    -on "Change Triggers " select ONLY Value, then insert one of your boolen tag ( where it’s written "Tag Path(s) )
    -finally, go on the Script tab and write your script.
    Since you have just to insert data inside a table, the script will be something like this:

query = “INSERT INTO table_name (column1, column2, column3, …) VALUES (value1, value2, value3, …)”

then do the same thing fot the other Boolen tag

You may want to consider using a transaction group using hour meters.


We don’t have Transaction Group license, we have taken Tag Historian license.