Hello
I like to print a label using script. I have label setup in Vision as container. This label contains 2 dynamic values. I am getting the values from the database and then I have a script to print an individual label per database row.
#Select query
pyData = system.db.runQuery ("SELECT * FROM [Ignition].[dbo].[Visitors_Conference]")
#printing parameters
def printout():
job = system.print.createPrintJob(event.source.parent.getComponent('Container'))
job.setShowPrintDialog(0)
job.setPageHeight(3.93701)
job.setPageWidth(2.44094)
job.setMargins(.1)
#job.setZoomFactor(0.9)
job.setOrientation(0)
job.print()
#Go through all rows in dataset
for row in pyData:
Name = row["Name"]
Grouping = row["Grouping"]
#update sample field for print out
event.source.parent.getComponent('Container').getComponent('lbl_Name').text = Name
#Print the label
system.util.invokeLater(printout, 2000)
The problem is that it only print the last row. For example, I have a simple table with 4 rows and some data. I want to print let's say names on the label. So it should print 4 labels with each row name, but instead it's printing just the Last row (Name 4) on all of them.