# Script Console - runNamedQuery

**URL:** <https://forum.inductiveautomation.com/t/script-console-runnamedquery/88557>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [April 9, 2024, 6:24am UTC](https://forum.inductiveautomation.com/t/script-console-runnamedquery/88557 "2024-04-09T06:24:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Kranjc](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_kranjc/32/43007_2.png) [@David\_Kranjc](https://forum.inductiveautomation.com/u/David_Kranjc)\
**Post date:** [April 9, 2024, 6:24am UTC](https://forum.inductiveautomation.com/t/script-console-runnamedquery/88557/1 "2024-04-09T06:24:41Z")

</div>

Hello,  
why do I get an error when I call the script via Script Console?  
If I call the same script via button in perspective, everything works fine.

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/8/08f5cc79f80537ccb5039468737d768df9d34fd2.png)

Many thanks in advance,  
David

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [April 9, 2024, 7:53am UTC](https://forum.inductiveautomation.com/t/script-console-runnamedquery/88557/2 "2024-04-09T07:53:02Z")

</div>

Script console is **NOT** gateway scope.  
You're calling runNamedQuery in [gateway scope syntax](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-db/system-db-runNamedQuery#gateway-scope-syntax)...  
Try calling it in client scope (without the project name).

---

<div class="post-metadata">

**Author:** ![David\_Kranjc](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_kranjc/32/43007_2.png) [@David\_Kranjc](https://forum.inductiveautomation.com/u/David_Kranjc)\
**Post date:** [April 9, 2024, 8:06am UTC](https://forum.inductiveautomation.com/t/script-console-runnamedquery/88557/3 "2024-04-09T08:06:00Z")

</div>

Thank you very much. Now it works 🙂
