Good night, my name is Felipe and I’m new to Ignition. I received a mission to add the hfiNumber values of each process machine (eg cupper, bodymaker, decorator) to the ignition screen next to each machine. I intend to place a numeric label next to each machine on the client’s screen informing hfiNumber. I made this little application that writes the values in a table named hfi from a MySQL database. The script in the Submit button is:
timeStamp = event.source.parent.getComponent('Label').text
line= event.source.parent.getComponent('Dropdown 1').selectedStringValue
machine = event.source.parent.getComponent('Dropdown').selectedStringValue
hfis=event.source.parent.getComponent('Spinner').intValue
description = event.source.parent.getComponent('Text Area').text
query = "INSERT INTO `ign_historical`.`hfi` (timeStamp, Line, Machine, hfiNumber, Description) VALUES (?,?,?,?,?)"
args = [timeStamp, line, machine, hfis, description]
system.db.runPrepUpdate(query,args)
os valores do componente tabela vem de uma consulta SQL
SELECT * FROM hfi
However, as the values filled in by the factory’s quality department staff (Line, Machine, hfiNumber and description) will be fed throughout the day, I don’t know how I add the hfi number values of a machine during an interval shift, for example: the Cupper machine from line 22, from 7:00 am to 7:00 pm, on April 4, hfiNumber is equal to 4, the Cupper machine from line 23 hfiNumber is equal to 2 (as shown in the example in the image). I do not know how I add these values for a given machine during a certain time interval and the values will be filled in randomly by the quality department
I tried to do this using the lookup script function, but it only returns the value of the row above the specified column, and I need the sum within a time interval, since the process is divided by shift.
the other question is also that I added edit and delete buttons, in case I want to edit a line or delete a line directly from the database. but I have no idea how to edit or delete a selected line.
In this small project I tried to use inserting data directly into the database. but if anyone has a new and more practical idea of how the people in the quality department would insert these values into the ignition and how I can get the data from hfiNumber will be very welcome. As I’m new to Ignition, I still have a lot to learn
thank you very much!!!