# Issue with system.db.runPrepUpdate in Perspective

**URL:** <https://forum.inductiveautomation.com/t/issue-with-system-db-runprepupdate-in-perspective/38479>\
**Category:** Ignition\
**Tags:** database, ignition80, scripting, perspective\
**Created:** [September 8, 2020, 4:52pm UTC](https://forum.inductiveautomation.com/t/issue-with-system-db-runprepupdate-in-perspective/38479 "2020-09-08T16:52:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dholt](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dholt/32/4458_2.png) [@dholt](https://forum.inductiveautomation.com/u/dholt)\
**Post date:** [September 8, 2020, 4:52pm UTC](https://forum.inductiveautomation.com/t/issue-with-system-db-runprepupdate-in-perspective/38479/1 "2020-09-08T16:52:42Z")

</div>

Greetings. I have a flex container that I'll run in an embedded view for our users in our dis-assembly process. Currently when we register a defective part we take to a hold area for a user to determine what parts are scrapped; What parts are ok to use again and what parts weren't affected (Never made it on the part). I've created a table with boolean values that I'm able to change by clicking to determine what's scrap/return/etc.. There's a column in this table called "indx" which is the incident log value that's unique each time a defect is logged. I'm using this indx value in the runPrepUpdate. When I write this in SSMS it works fine, when I write it in the runPrepUpdate it's not working correctly at all. It's trying to pull values from a table instead of a drop down.

Screen:

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/8/988eec64834f857b9b5119ea55fbc5a667692cbd.jpeg)

Script:

> 

```
ind=self.getSibling("Dropdown").props.value
x=self.getSibling("Dropdown").props.options
query="insert into assy_scrap_logging (component,qty,[action]) SELECT component,qty,'scrap' 
from ASSY_Scrap_Journal where indx = ? and scrap = '1'"		
system.db.runPrepUpdate(query,(ind))

```

Error I'm getting:

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/9/a9f8ae208be0cfafd4b0030c3e14551809c6b187.jpeg)

As always any help is greatly appreciated! Thanks in Advance!

---

<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:** [September 8, 2020, 6:11pm UTC](https://forum.inductiveautomation.com/t/issue-with-system-db-runprepupdate-in-perspective/38479/2 "2020-09-08T18:11:05Z")

</div>

You’re wrapping `ind` incorrectly; the function expects a list, and you’re just wrapping it in parens.  
try this:

```auto
system.db.runPrepUpdate(query,[ind])

```

---

<div class="post-metadata">

**Author:** ![dholt](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dholt/32/4458_2.png) [@dholt](https://forum.inductiveautomation.com/u/dholt)\
**Post date:** [September 8, 2020, 6:16pm UTC](https://forum.inductiveautomation.com/t/issue-with-system-db-runprepupdate-in-perspective/38479/3 "2020-09-08T18:16:14Z")

</div>

I. am. dumb.

Thank you friend. I’ve only looked at this about 58 times this morning.
