# Perspective Text Field Data Entry Issue

**URL:** <https://forum.inductiveautomation.com/t/perspective-text-field-data-entry-issue/61138>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [June 23, 2022, 10:50pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-data-entry-issue/61138 "2022-06-23T22:50:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vcarranza](https://avatars.discourse-cdn.com/v4/letter/v/51bf81/32.png) [@vcarranza](https://forum.inductiveautomation.com/u/vcarranza)\
**Post date:** [June 23, 2022, 10:50pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-data-entry-issue/61138/1 "2022-06-23T22:50:10Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/a/1a2620b9f7feb191d5c8001e842187215aa37a31.png)

```
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 = ""

```

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [June 23, 2022, 11:08pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-data-entry-issue/61138/2 "2022-06-23T23:08:58Z")

</div>

What is the error you get when you run that script?

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [June 23, 2022, 11:21pm UTC](https://forum.inductiveautomation.com/t/perspective-text-field-data-entry-issue/61138/3 "2022-06-23T23:21:32Z")

</div>

I find using [system.db.runNamedQuery](https://docs.inductiveautomation.com/display/DOC81/system.db.runNamedQuery) to be much easier, plus it doesn’t require legacy db access.
