I am working on my demo system and I am now in the operator data collection portion of it.
This is the part of the application where we throw the paper and clipboard away and enter runtime info, etc. directly into the SCADA application.
I have designed a “form” that has text boxes and selectors. The operator enters the hours, amps, etc. into these text boxes. When they click the submit button the following code is executed.
ID = event.source.parent.getComponent(‘lblID’).text
TIMESTAMP = ‘NOW()’
USER = system.tag.getTagValue("[System]Client/User/Username")
P1HM = event.source.parent.getComponent(‘txtP1HM’).floatValue
P2HM = event.source.parent.getComponent(‘txtP2HM’).floatValue
P3HM = event.source.parent.getComponent(‘txtP3HM’).floatValue
P4HM = event.source.parent.getComponent(‘txtP4HM’).floatValue
P5HM = event.source.parent.getComponent(‘txtP5HM’).floatValue
P6HM = event.source.parent.getComponent(‘txtP6HM’).floatValue
P1AMP = event.source.parent.getComponent(‘txtP1Amp’).floatValue
P2AMP = event.source.parent.getComponent(‘txtP2Amp’).floatValue
P3AMP = event.source.parent.getComponent(‘txtP3Amp’).floatValue
P4AMP = event.source.parent.getComponent(‘txtP4Amp’).floatValue
P5AMP = event.source.parent.getComponent(‘txtP5Amp’).floatValue
P6AMP = event.source.parent.getComponent(‘txtP6Amp’).floatValue
GENHM = event.source.parent.getComponent(‘txtGeneratorHM’).floatValue
GENFUELCODE =event.source.parent.getComponent(‘selGeneratorFuel’).selectedValue
NOTES = event.source.parent.getComponent(‘txtNotes’).text
system.db.runUpdateQuery(“INSERT INTO lsdc_stationinformation VALUES (%s, %s, ‘%s’,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, ‘%s’)” % (ID, TIMESTAMP, USER, P1HM, P2HM, P3HM, P4HM, P5HM, P6HM, P1AMP, P2AMP, P3AMP, P4AMP, P5AMP, P6AMP, GENHM, GENFUELCODE, NOTES), ‘WWFLINTROCK’)
I have tested and this works just fine, however it seems really clunky to me. Any tips are appreciated.
Thanks.