I am attempting to log a number into a sql database. In Ignition perspective, I have a text field with a number (310-31149590, including the dash) and I have a button that has an onClick Event that executes a script when the button is clicked on. The script assigns the number to a variable, enters the variable into an insert sql query, and runs a system.db.runUpdateQuery to insert the record into the database.
The script fails when I insert the number above. It passes when I remove the last digit. I thought it had to do with the SQL side of this execution, but I can insert the number directly into the database using SQL INSERT INTO commands. I can also enter a number that does not end with a zero and the same thing happens.
Any Idea what could be happening? Is the dash affecting it?
Here is the image of text Field and button.
NUM_SHIP = self.getSibling("TextField").props.text SQL = """ INSERT INTO [SHIP].[NUM_SHIP] (WHSE, NUM_SHIP, IN_TRANSIT_DTTM, SHIP_ID, IN_TRANSIT) VALUES ('@WHSE', '@NUM_SHIP', GETDATE(), CONCAT('@NUM_SHIP','=','@DOOR_NUM ',CAST(GETDATE() AS DATETIME2)), 1) """ SQL=SQL.replace('@NUM_SHIP', NUM_SHIP) system.db.runUpdateQuery(SQL) self.getSibling("TextField").props.text = ""