SQLTags Alarm Edit Goodie

I have about 30 or more tags set up through this goodie.
inductiveautomation.com/prod … ies/?id=17

Now I have 3 tags :


And another tag:


Is there a way to write the Batch_Record next to all the alarms and events tags in the AlarmLog table, only when I see all the alarms and events that occur between Auto_Cycle_Started and Auto_Cycle_Completed or between Auto_Cycle_Started and Auto_Cycle_Aborted, and all other times don’t record a Batch_Record next to the alarms.

Any insight will be greatly appreciated. This would make it easier to relate the data for the recipe to the alarms and events that occur during the recipe.

E.g. AlarmLog table with the Batch_Record column added

Auto_Cycle_Start Batch_Record
Event1 Batch_Record
Event5 Batch_Record
Alarm7 Batch_Record
Auto_Cycle_Completed Batch_Record

As far as I know, you are not able to add fields to the AlarmLog table.

I think you will have to distinguish between alarms, which you want to know about immediately, and data which should be logged for later analysis. It seems to me that what you are trying to do is create a batch record detailing the important events in the course of making a product, ending up with a record like this:

Batch_Record, Auto_Cycle_Started, Auto_Cycle_Completed, Auto_Cycle_Aborted

This would normally be done using FactorySQL logging, rather than FactoryPMI alarming. You could also log events against the Batch_Record, although in that case you would end up with a table with multiple entries, like:

Batch_Record, Event1
Batch_Record, Event2
Batch_Record, Event3

Let me know if this sounds like what you’re trying to achieve (or if it isn’t!) and I’ll try to help you set things up.


You can also have FactorySQL log a history of your batches, and then correlate alarms (and anything else) to their batch via the timestamp.

I have something similar I want to do. While in the ALARM HISTORY window of the client, I would like to be able to see what campaign and batch # I was running when the alarm occurred.

I obviously have an “alarmlog” table fed from sqltags (for 5 individual machines). 2 Master batch lines have 750 alarms each, 2 Final mix lines have 450 alarms each and 1 OIL PLC has about 100 Alarms. (approx.)

So in total approx. 2500 alarms. For 2400 of them, I need recipe name and batch #. For each line (L11-L14) I have 1 table for batch # and start time, and 1 table for recipe name and start time. I need to SOME HOW do a JOIN??? perhaps? and show the recipe and batch # in the same table as the alarms.

So, for example i’ll give you 4 alarm entries and some columns:
alarmlog table:

AlarmLog_ndx, active_time, clear_time, item_name, state_name

1, 2009-06-01 12:00:30, 2009-06-01 12:01:00, L11_Alarm_01, Alarm1
2, 2009-06-01 12:00:35, 2009-06-01 12:05:00, L12_Alarm_02, Alarm2
3, 2009-06-01 12:00:32, 2009-06-01 12:01:12, L13_Alarm_03, Alarm3
4, 2009-06-01 12:00:38, 2009-06-01 12:00:55, L14_Alarm_04, Alarm4

(each lines recipe and batch tables are structured the same way)
L11_batch table:

ID, batch_number, start_time

1, 17, 2009-06-01 12:00:00
2, 18, 2009-06-01 12:01:30

L12_recipe table:

ID, recipe_name, start_time

1, blackrubber, 2009-06-01 11:45:00
2, bluerubber, 2009-06-01 12:30:30

So, how do I take a LIST of alarms and get each one to show which recipe and batch was running?

… As a side note, it would be COOL to have the STATE_NAME dynamic. Just as when you add a tag and can use OTHER tags to drive the severity, it would be cool to INSERT information into the state_name when the alarm is stored in alarmlog.