# Automatic Popups and Print jobs

**URL:** <https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183>\
**Category:** Archived Topics\
**Created:** [June 16, 2009, 6:04pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183 "2009-06-16T18:04:19Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris\_d\_sanders](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chris_d_sanders/32/3359_2.png) [@chris\_d\_sanders](https://forum.inductiveautomation.com/u/chris_d_sanders)\
**Post date:** [June 16, 2009, 6:04pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/1 "2009-06-16T18:04:19Z")

</div>

I have this “PANELVIEW” made by a WONDERFUL company… lol… I am now trying to do away with it and replace it with a touchscreen computer.

The only REAL function of this PV is to display a flow chart based on an ALARM it recieves VIA MSG from a PLC5. So, 10 alarms = 10 different flowcharts. They automatically POPUP and display and THEN they print.

I would like to accomplish this with FPMI.

Any suggestions?

-Chris

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [June 16, 2009, 8:32pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/2 "2009-06-16T20:32:03Z")

</div>

Well, FactoryPMI isn’t going to directly consume messages from a PLC5. Your best bet would be to put a touch-computer out there and have the whole stack (OPC-FactorySQL-DB-FactoryPMI) and have [del]in[/del] it running one client.

Can you explain what you mean by flow-chart as it applies to alarms?

---

<div class="post-metadata">

**Author:** ![chris\_d\_sanders](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chris_d_sanders/32/3359_2.png) [@chris\_d\_sanders](https://forum.inductiveautomation.com/u/chris_d_sanders)\
**Post date:** [June 17, 2009, 1:09am UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/3 "2009-06-17T01:09:08Z")

</div>

ok… lets say i have 10 alarms and each one requires you to take specific actions. I have already created sqltags for them by the way. For each alarm, exists a “slide” if you will created in visio. i can make it html or a picture or anything. what i need to do is trigger a POPUP window when an alarm becomes active. and in that window there will be a corresponding Slide that is specific for that alarm. Also, i will need it to print and then close the window. So lets say alarm happens, window opens, five seconds later it prints and then 5 seconds later it closes. Thats just an example. I am willing to do what it takes and I will understand if there are limitations

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [June 17, 2009, 1:22am UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/4 "2009-06-17T01:22:53Z")

</div>

Oh, ok, I’m with you now. In this case its not very hard, other than the somewhat odd requirement of having 1 and exactly 1 FactoryPMI client running all the time.

You basically just need to run a timer script that is checking the current alarm state or monitoring the alarm log (via SQL queries) and opening the correct window, printing your flow chart, and closing it. You’ll want to make use of the fpmi.system.invokeLater function.

---

<div class="post-metadata">

**Author:** ![chris\_d\_sanders](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chris_d_sanders/32/3359_2.png) [@chris\_d\_sanders](https://forum.inductiveautomation.com/u/chris_d_sanders)\
**Post date:** [June 17, 2009, 2:12pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/5 "2009-06-17T14:12:57Z")

</div>

Here is a slight modification that will also hopefully simplify the process. I dont NEED a popup, I just need to FIRST have a dynamic property that lists the alarm, time and batch info as a header if you will. Second, print “SOME FILE” ie: picture, html, word…

So looking at the supposed printed page, at the top would be our header consisting of dynamic properties and below it would be our “Flow chart”.

A code snippet might also help me to understand how you propose I should go about this.

Thanks,

-Chris

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [June 17, 2009, 3:42pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/6 "2009-06-17T15:42:43Z")

</div>

The way I would go about this would be to add an extra column to the alarm log table, like  
printed INTEGER DEFAULT 0

That way our script can definitively tell whether each alarm in the alarm log has been printed or not. Then you would run a timer script that went something like this:

[code]

# Get a list of the alarms that have not yet been printed

alarms = fpmi.db.runQuery(“SELECT \* FROM alarmlog WHERE printed = 0”)

for alarm in alarms:

# Loop through the alarms, open a window associated with each one

# and print it out.

id = alarm[“alarmlog\_ndx”]  
name = alarm[“item\_name”]  
window = (somehow associate name with a window to open)  
def openAndPrint(windowName=window):  
import fpmi  
fpmi.nav.openWindow(windowname)  
def printLater(windowName=windowName):  
import fpmi  
window = fpmi.gui.getWindow(windowName)  
printJob = fpmi.print.createPrintJob(window.rootContainer)  
printJob.showPrintDialog = 0  
printJob.print()  
fpmi.system.invokeLater(printLater, 5000)  
fpmi.system.invokeLater(openAndPrint)

fpmi.db.runPrepStmt(“UPDATE alarmlog SET printed=1 WHERE alarmlog\_ndx = ?”, id)[/code]

Hope this helps,

---

<div class="post-metadata">

**Author:** ![chris\_d\_sanders](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chris_d_sanders/32/3359_2.png) [@chris\_d\_sanders](https://forum.inductiveautomation.com/u/chris_d_sanders)\
**Post date:** [June 17, 2009, 6:20pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/7 "2009-06-17T18:20:23Z")

</div>

Awesome, Thank you Carl. Now, as with all thing, I want MORE. 😃

Instead of `def printLater(windowName=windowName):
         import fpmi
         window = fpmi.gui.getWindow(windowName)
         printJob = fpmi.print.createPrintJob(window.rootContainer)
         printJob.showPrintDialog = 0
         printJob.print()`

I now am using a Report for my flowcharts and want to use the PRINT feature of the Report. LOL

[code]# Get a list of the alarms that have not yet been printed  
alarms = fpmi.db.runQuery(“SELECT \* FROM alarmlog WHERE printed = ‘0’ AND severity = ‘1’”)

for alarm in alarms:

# Loop through the alarms, open a window associated with each one

# and print it out.

id = alarm[“AlarmLog\_ndx”]  
name = alarm[“item\_name”]  
window = “Report”  
def openAndPrint(Report=window):  
import fpmi  
fpmi.nav.openWindow(Report)  
def printLater(Report=Report):  
import fpmi  
window = fpmi.gui.getWindow(Report)  
printJob = window.getRootContainer().getComponent(‘Report Viewer’)  
printJob.print()  
fpmi.system.invokeLater(printLater, 1000)  
fpmi.system.invokeLater(openAndPrint)  
def closeAfterPrint(Report=window):  
import fpmi  
fpmi.nav.closeWindow(Report)  
fpmi.system.invokeLater(closeAfterPrint, 5000)  
fpmi.db.runPrepStmt(“UPDATE alarmlog SET printed=1 WHERE alarmlog\_ndx = ?”, [id]) [/code]

I can now make the Report print, but now I can not specify “printJob.showPrintDialog = 0”  
Any ideas?

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [June 17, 2009, 8:05pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/8 "2009-06-17T20:05:30Z")

</div>

Sure, the report.print() has some overloads, one of which supresses the dialog and takes the name of the printer to print to, or None for the default. You should also be able to close the window right after printing.

[code]# Get a list of the alarms that have not yet been printed  
alarms = fpmi.db.runQuery(“SELECT \* FROM alarmlog WHERE printed = ‘0’ AND severity = ‘1’”)

for alarm in alarms:

# Loop through the alarms, open a window associated with each one

# and print it out.

id = alarm[“AlarmLog\_ndx”]  
name = alarm[“item\_name”]  
window = “Report”  
def openAndPrint(Report=window):  
import fpmi  
fpmi.nav.openWindow(Report)  
def printLater(Report=Report):  
import fpmi  
window = fpmi.gui.getWindow(Report)  
report = window.getRootContainer().getComponent(‘Report Viewer’)  
report.print(None, 0)  
fpmi.nav.closeWindow(Report)  
fpmi.system.invokeLater(printLater, 1000)  
fpmi.system.invokeLater(openAndPrint)  
fpmi.db.runPrepStmt(“UPDATE alarmlog SET printed=1 WHERE alarmlog\_ndx = ?”, [id])[/code]

---

<div class="post-metadata">

**Author:** ![chris\_d\_sanders](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chris_d_sanders/32/3359_2.png) [@chris\_d\_sanders](https://forum.inductiveautomation.com/u/chris_d_sanders)\
**Post date:** [June 18, 2009, 12:50pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/9 "2009-06-18T12:50:05Z")

</div>

Thank you very much, I have used the

`print(None, 0)
` on other things before yet it seemed to have slipped my mind yesterday. LOL

I have been reading some other postings on the forum concerning printing, and have a question. Is it possible yet to SPECIFY the orientation in CODE?

Thanks,

-Chris

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [June 18, 2009, 2:09pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/10 "2009-06-18T14:09:35Z")

</div>

The orientation of a report is part of the design of the report - you set it in the report designer (the report panel’s customizer)

---

<div class="post-metadata">

**Author:** ![chris\_d\_sanders](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chris_d_sanders/32/3359_2.png) [@chris\_d\_sanders](https://forum.inductiveautomation.com/u/chris_d_sanders)\
**Post date:** [June 18, 2009, 3:33pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/11 "2009-06-18T15:33:59Z")

</div>

Thanks Carl.

Ok… Now the easy stuff is all working, when I get an alarm, the report pops up, it prints automatically, and the window closes.

NOW comes the hard part. First of all, when I have lets say 3 alarms come up at once, I notice the report pops up, prints then closes. I get three print outs, but I only see one popup. I am sure there is some TIMER or invoke later that I am missing, but I can’t be sure.

So, what I feel this global timer needs to do is only select ONE alarm at a time not select ALL, then once the query is ran, I need it to SOME HOW pass certain column info, like

`id = alarm["AlarmLog_ndx"]
name = alarm["item_name"]`

into dynamic properties now contained in my report.

I already use a couple of windows that pass parameters to another window and OPEN said window. Of course this is “Configure action” and then using the NAV tab. But i imagine the code would be similar.

Used and proven in OTHER project:

```auto
# This script was generated automatically by the navigation
# script builder. You may modify this script, but if you do,
# you will not be able to use the navigation builder to modify
# this script without overwriting your changes.

param1 = event.source.parent.GanntTable

param2 = event.source.parent.getComponent('Filter').getComponent('Line').selectedLabel

fpmi.nav.swapTo('Delay Chart', {'GanntTable' : param1, 'linename' : param2})
```

Now, what i have tried but does not work (my Dynamic property I have in the report is ‘Alarm’:

```auto
# Get a list of the alarms that have not yet been printed
alarms = fpmi.db.runQuery("SELECT * FROM alarmlog WHERE printed = '0' AND severity = '1'")

for alarm in alarms:
   # Loop through the alarms, open a window associated with each one
   # and print it out.
   id = alarm["AlarmLog_ndx"]
   name = alarm["item_name"]
   window = "Report"
   def openAndPrint(Report=window):
      import fpmi
      fpmi.nav.openWindow(Report, {'Alarm' : name}))
      def printLater(Report=Report):
         import fpmi
         window = fpmi.gui.getWindow(Report)
         report = window.getRootContainer().getComponent('Report Viewer')
         report.print(None, 0)
      fpmi.system.invokeLater(printLater, 1000)
   fpmi.system.invokeLater(openAndPrint)
   def closeAfterPrint(Report=window):
      import fpmi
      fpmi.nav.closeWindow(Report)
   fpmi.system.invokeLater(closeAfterPrint, 3000)
   fpmi.db.runPrepStmt("UPDATE alarmlog SET printed=1 WHERE alarmlog_ndx = ?", [id])
```

The error i get is

`Traceback (innermost last):
  File "<TimerScript:alarm_log_print (20000) [Delay, Shared]>", line 12, in openAndPrint
NameError: name
`

Thanks,

-Chris

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [June 18, 2009, 3:53pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/12 "2009-06-18T15:53:21Z")

</div>

Ok, here are some changes that will

1. only do one at a time. Make sure to run the script slow enough so that each popup has time to open, print, and close before the script runs again.
2. pass info into the window using parameters. See the [user manual](http://www.inductiveautomation.com/products/factorypmi/usermanual/source/technical/jython/modulesnav.htm#openwindow) for more on passing parameters into windows.

[code]# Get a list of the alarms that have not yet been printed  
alarms = fpmi.db.runQuery(“SELECT \* FROM alarmlog WHERE printed = 0 AND severity = 1 LIMIT 1”)

if len(alarms)\>0:  
alarm = alarms[0]  
id = alarm[“AlarmLog\_ndx”]  
name = alarm[“item\_name”]  
window = “Report”  
def openAndPrint(Report=window):  
import fpmi  
# pass alarm name in as parameter to report window  
fpmi.nav.openWindow(Report, {“alarmName”:name})  
def printLater(Report=Report):  
import fpmi  
window = fpmi.gui.getWindow(Report)  
report = window.getRootContainer().getComponent(‘Report Viewer’)  
report.print(None, 0)  
fpmi.nav.closeWindow(Report)  
fpmi.system.invokeLater(printLater, 1000)  
fpmi.system.invokeLater(openAndPrint)  
fpmi.db.runPrepStmt(“UPDATE alarmlog SET printed=1 WHERE alarmlog\_ndx = ?”, [id])[/code]

---

<div class="post-metadata">

**Author:** ![chris\_d\_sanders](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chris_d_sanders/32/3359_2.png) [@chris\_d\_sanders](https://forum.inductiveautomation.com/u/chris_d_sanders)\
**Post date:** [June 18, 2009, 4:04pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/13 "2009-06-18T16:04:00Z")

</div>

I used your code:

```auto
# Get a list of the alarms that have not yet been printed
alarms = fpmi.db.runQuery("SELECT * FROM alarmlog WHERE printed = 0 AND severity = 1 LIMIT 1")

if len(alarms)>0:
   alarm = alarms[0]
   id = alarm["AlarmLog_ndx"]
   name = alarm["item_name"]
   window = "Report"
   def openAndPrint(Report=window):
      import fpmi
      # pass alarm name in as parameter to report window
      fpmi.nav.openWindow(Report, {"Alarm":name}) 
      def printLater(Report=Report):
         import fpmi
         window = fpmi.gui.getWindow(Report)
         report = window.getRootContainer().getComponent('Report Viewer')
         report.print(None, 0)
         fpmi.nav.closeWindow(Report)
      fpmi.system.invokeLater(printLater, 1000)
   fpmi.system.invokeLater(openAndPrint)
   fpmi.db.runPrepStmt("UPDATE alarmlog SET printed=1 WHERE alarmlog_ndx = ?", [id])
```

Now i get the red error box with this in it:

```auto

Traceback (innermost last):
  File "<TimerScript:alarm_log_print (20000) [Delay, Shared]>", line 12, in openAndPrint
NameError: name

	at org.python.core.Py.NameError(Py.java)
	at org.python.core.PyFrame.getglobal(PyFrame.java)
	at org.python.pycode._pyx435.openAndPrint$1(<TimerScript:alarm_log_print (20000) [Delay, Shared]>:12)
	at org.python.pycode._pyx435.call_function(<TimerScript:alarm_log_print (20000) [Delay, Shared]>)
	at org.python.core.PyTableCode.call(PyTableCode.java)
	at org.python.core.PyTableCode.call(PyTableCode.java)
	at org.python.core.PyTableCode.call(PyTableCode.java)
	at org.python.core.PyFunction. __call__ (PyFunction.java)
	at com.inductiveautomation.factorypmi.application.script.ScriptManager.runFunction(ScriptManager.java:255)
	at com.inductiveautomation.factorypmi.application.script.builtin.SystemUtilities$1.run(SystemUtilities.java:164)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
```

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [June 18, 2009, 11:46pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/14 "2009-06-18T23:46:16Z")

</div>

Oh, yeah, you’ll have to pass the alarm name into the scope of the print function, like this:

```auto
   def openAndPrint(Report=window, name=name):
```

---

<div class="post-metadata">

**Author:** ![chris\_d\_sanders](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chris_d_sanders/32/3359_2.png) [@chris\_d\_sanders](https://forum.inductiveautomation.com/u/chris_d_sanders)\
**Post date:** [June 19, 2009, 12:57pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/15 "2009-06-19T12:57:26Z")

</div>

Thanks… lol but before I got your reply, I tried this:

```auto
# Get a list of the alarms that have not yet been printed
alarms = fpmi.db.runQuery("SELECT * FROM alarmlog WHERE printed = 0 AND severity = 1 LIMIT 1")

if len(alarms)>0:
   alarm = alarms[0]
   id = alarm["AlarmLog_ndx"]
   name = alarm["state_name"] 
   time = alarm["active_time"]
   line = alarm["point_path"]
   item = alarm["item_name"]
   window = "Report"
   fpmi.nav.openWindow("Report", {"Alarm" : name, "active_time" : time, "line" : line, "item_name" : item})
   def openAndPrint(Report=window):
      import fpmi
      # pass alarm name in as parameter to report window
      def printLater(Report=Report):
         import fpmi
         window = fpmi.gui.getWindow(Report)
         report = window.getRootContainer().getComponent('Report Viewer')
         report.print(None, 0)
         fpmi.nav.closeWindow(Report)
      fpmi.system.invokeLater(printLater, 1000)
   fpmi.system.invokeLater(openAndPrint)
   fpmi.db.runPrepStmt("UPDATE alarmlog SET printed=1 WHERE alarmlog_ndx = ?", [id])
```

I know I am opening the window before i get to my “openAndPrint”, but other than that, is there anything wrong with doing it that way? Could it possibly cause problems?

---

<div class="post-metadata">

**Author:** ![chris\_d\_sanders](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chris_d_sanders/32/3359_2.png) [@chris\_d\_sanders](https://forum.inductiveautomation.com/u/chris_d_sanders)\
**Post date:** [June 19, 2009, 1:34pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/16 "2009-06-19T13:34:25Z")

</div>

Also on a related note, I have a STRING that I am passing to my report.  
These are from the “point\_path” column in the “alarmlog” table.  
I will list 4 examples:  
“L11 Lab Alarms/Lab\_Alarm\_02”  
“L12 Lab Alarms/Lab\_Alarm\_02”  
“L13 Lab Alarms/Lab\_Alarm\_02”  
“L14 Lab Alarms/Lab\_Alarm\_02”

Based on those tags, I need to query only ONE of four tables:  
“l11\_batch”  
“l12\_batch”  
“l13\_batch”  
“l14\_batch”

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [June 19, 2009, 3:55pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/17 "2009-06-19T15:55:02Z")

</div>

[quote=“chris\_d\_sanders”]Thanks… lol but before I got your reply, I tried this  
…[snip]…  
I know I am opening the window before i get to my “openAndPrint”, but other than that, is there anything wrong with doing it that way? Could it possibly cause problems?[/quote]

Sounds fine to me.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [June 19, 2009, 3:56pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/18 "2009-06-19T15:56:57Z")

</div>

[quote=“chris\_d\_sanders”]Also on a related note, I have a STRING that I am passing to my report…  
Based on those tags, I need to query only ONE of four tables:[/quote]

I would have a query binding on that window whose table was dynamic, like:

```auto
SELECT * FROM {Root Container.TableName}
```

And have TableName be a dynamic string property on the root container that had an expression binding that resolved your point path to a table name (maybe using a switch expression)

---

<div class="post-metadata">

**Author:** ![chris\_d\_sanders](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chris_d_sanders/32/3359_2.png) [@chris\_d\_sanders](https://forum.inductiveautomation.com/u/chris_d_sanders)\
**Post date:** [June 19, 2009, 5:36pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/19 "2009-06-19T17:36:04Z")

</div>

Ok, I can now query other tables in MYSQL based off of my ACTIVE\_TIME that I am passing to the report window, BUT I have one problem. I have 8 different tables:

l11\_batch  
l11\_recipe  
l12\_batch  
l12\_recipe  
l13\_batch  
l13\_recipe  
l14\_batch  
l14\_recipe

I’m having a problem getting the right TABLE to query.  
I am attaching the project so you can see my GLOBAL SCRIPT TIMER and my REPORT window.

I know that I am just having some sort of TIMING issue with it POPPING up the window, querying, and populating the dynamic properties and then print and close.

Just cant figure out HOW to fix it.  
[reportWindow.fwin](https://us1.discourse-cdn.com/inductiveautomation/original/1X/ad34ed3ed6fc4db40d614006d8ac7244e77dfe10.fwin) (151 KB)  
[lab\_alarms.fpmi](https://us1.discourse-cdn.com/inductiveautomation/original/1X/f5d3420d7f4ab24b6e700e4813d6f085a24db27d.fpmi) (315 KB)

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [June 19, 2009, 6:58pm UTC](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183/20 "2009-06-19T18:58:54Z")

</div>

[quote=“chris\_d\_sanders”]I’m having a problem getting the right TABLE to query.  
I am attaching the project so you can see my GLOBAL SCRIPT TIMER and my REPORT window.

I know that I am just having some sort of TIMING issue with it POPPING up the window, querying, and populating the dynamic properties and then print and close.

Just cant figure out HOW to fix it.[/quote]

Can you describe to me the problem you’re having. I don’t have your database so I can’t really run your project and figure out what problem it is that you’re talking about.

[Next page](https://forum.inductiveautomation.com/t/automatic-popups-and-print-jobs/1183.md?page=2)
