# Mouse Click query using a dropdown

**URL:** <https://forum.inductiveautomation.com/t/mouse-click-query-using-a-dropdown/17311>\
**Category:** Ignition\
**Created:** [March 10, 2018, 1:55pm UTC](https://forum.inductiveautomation.com/t/mouse-click-query-using-a-dropdown/17311 "2018-03-10T13:55:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [March 10, 2018, 1:55pm UTC](https://forum.inductiveautomation.com/t/mouse-click-query-using-a-dropdown/17311/1 "2018-03-10T13:55:00Z")

</div>

Script I am trying to use when a mouse is clicked. It gives me a mismatched syntaxerror. Any ideas?

SELECT \* FROM MobileWorkOrder  
WHERE Equipment = ‘{event.source.parent.getComponent(‘Dropdown’).selectedLabel}’

---

<div class="post-metadata">

**Author:** ![David.Reed.Schmidt](https://avatars.discourse-cdn.com/v4/letter/d/5f9b8f/32.png) [@David.Reed.Schmidt](https://forum.inductiveautomation.com/u/David.Reed.Schmidt)\
**Post date:** [March 10, 2018, 2:48pm UTC](https://forum.inductiveautomation.com/t/mouse-click-query-using-a-dropdown/17311/2 "2018-03-10T14:48:23Z")

</div>

Try a printing the query statement to the console. For example, print query. This will help us understand the behavior of the dropdown and mouse click event.

---

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [March 10, 2018, 3:16pm UTC](https://forum.inductiveautomation.com/t/mouse-click-query-using-a-dropdown/17311/3 "2018-03-10T15:16:14Z")

</div>

This is what it says

File “”, line 1  
SELECT \* FROM MobileWorkOrder  
^  
SyntaxError: mismatched input ‘MobileWorkOrder’ expecting NEWLINE

---

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [March 10, 2018, 3:17pm UTC](https://forum.inductiveautomation.com/t/mouse-click-query-using-a-dropdown/17311/4 "2018-03-10T15:17:09Z")

</div>

disregard last one

> > >

File "", line 1  
SELECT \* FROM MobileWorkOrder  
^  
SyntaxError: mismatched input 'MobileWorkOrder' expecting NEWLINE

> > >

---

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [March 10, 2018, 3:18pm UTC](https://forum.inductiveautomation.com/t/mouse-click-query-using-a-dropdown/17311/5 "2018-03-10T15:18:12Z")

</div>

it would add the

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 10, 2018, 5:38pm UTC](https://forum.inductiveautomation.com/t/mouse-click-query-using-a-dropdown/17311/6 "2018-03-10T17:38:19Z")

</div>

You’re trying to use SQL where python (jython) is expected. You need to construct your SQL in a string and submit it with one of the [system.db.\*](https://docs.inductiveautomation.com/display/DOC79/system.db) script functions.

---

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [March 10, 2018, 5:42pm UTC](https://forum.inductiveautomation.com/t/mouse-click-query-using-a-dropdown/17311/7 "2018-03-10T17:42:59Z")

</div>

I didn’t realize that until I went about it a different way. It works now. How do yo know when you need to use python and when you need to use sql. I am new to the scripting side of things.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 10, 2018, 5:45pm UTC](https://forum.inductiveautomation.com/t/mouse-click-query-using-a-dropdown/17311/8 "2018-03-10T17:45:17Z")

</div>

If it’s scripting, it’s python. If it’s a query, it’s SQL.

---

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [March 10, 2018, 6:20pm UTC](https://forum.inductiveautomation.com/t/mouse-click-query-using-a-dropdown/17311/9 "2018-03-10T18:20:48Z")

</div>

ok, thanks for the help
