# Perspective audit log query to database

**URL:** <https://forum.inductiveautomation.com/t/perspective-audit-log-query-to-database/73900>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [May 18, 2023, 2:33pm UTC](https://forum.inductiveautomation.com/t/perspective-audit-log-query-to-database/73900 "2023-05-18T14:33:07Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Ladrone](https://avatars.discourse-cdn.com/v4/letter/l/a698b9/32.png) [@Ladrone](https://forum.inductiveautomation.com/u/Ladrone)\
**Post date:** [May 19, 2023, 12:35pm UTC](https://forum.inductiveautomation.com/t/perspective-audit-log-query-to-database/73900/5 "2023-05-19T12:35:47Z")

</div>

> [@pturmel](#):
>
> Project library scripts **do not have their own scope**. They run in whatever scope calls them.

In the meantime I was figouring it out, the solution I found was in this post

> [@Best methods for checking script scope](https://forum.inductiveautomation.com/t/best-methods-for-checking-script-scope/30201/2):
>
> Try this: def getScope(): """ Returns: scope (int): 0=Gateway, 1=Client, 2=Designer """ try: if system.util.getSystemFlags() & system.util.CLIENT\_FLAG: location = 1 elif system.util.getSystemFlags() & system.util.DESIGNER\_FLAG: location = 2 except AttributeError: # system.util.getSystemFlags() does not exist in gateway scope location = 0 return location (Source: [Which scope is my code running in?](http://forum.inductiveautomation.com/t/which-scope-is-my-code-running-in/15540/3))

> [@pturmel](#):
>
> (Testing in the script console is never appropriate for gateway or perspective events.)

I wasn't testing it from console, but calling it from a button in persepective! In the console give me some other absurd errors by the way!

---

_[View the full topic](https://forum.inductiveautomation.com/t/perspective-audit-log-query-to-database/73900)._
