# Custom Menu using named query

**URL:** <https://forum.inductiveautomation.com/t/custom-menu-using-named-query/65771>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 27, 2022, 6:07pm UTC](https://forum.inductiveautomation.com/t/custom-menu-using-named-query/65771 "2022-10-27T18:07:25Z")\
**Posts on this page:** 6\
**Page:** 3

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 22, 2023, 11:38pm UTC](https://forum.inductiveautomation.com/t/custom-menu-using-named-query/65771/41 "2023-05-22T23:38:55Z")

</div>

Very true. As ever, don't write checks your ~~body~~ brain can't cash. I do think that structuring the code to 'look' the same as the JSON representation helps, at least. But it is definitely a conceptual hurdle to get over. Not much helping that - either you deal with learning list comprehensions, or you deal with learning about mutable references 🤷‍♂️ .

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [May 23, 2023, 12:51am UTC](https://forum.inductiveautomation.com/t/custom-menu-using-named-query/65771/42 "2023-05-23T00:51:07Z")

</div>

It's interesting to see this, I placed a print statement before the `append` function, and this is what I see:

```auto
17:47:58.589 [Browser Thread: 52554] INFO Perspective.Designer.Workspace - [{'showHeader': True, 'navIcon': {'path': ''}, 'label': {'icon': {'path': ''}, 'text': '2'}, 'target': '1', 'items': []}]
17:47:58.589 [Browser Thread: 52554] INFO Perspective.Designer.Workspace - [{'showHeader': True, 'navIcon': {'path': ''}, 'label': {'icon': {'path': ''}, 'text': '3'}, 'target': '1', 'items': []}, {'showHeader': True, 'navIcon': {'path': ''}, 'label': {'icon': {'path': ''}, 'text': '3'}, 'target': '2', 'items': []}]
17:47:58.589 [Browser Thread: 52554] INFO Perspective.Designer.Workspace - [{'showHeader': True, 'navIcon': {'path': ''}, 'label': {'icon': {'path': ''}, 'text': '4'}, 'target': '1', 'items': []}, {'showHeader': True, 'navIcon': {'path': ''}, 'label': {'icon': {'path': ''}, 'text': '4'}, 'target': '2', 'items': []}, {'showHeader': True, 'navIcon': {'path': ''}, 'label': {'icon': {'path': ''}, 'text': '4'}, 'target': '3', 'items': []}]

```

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [May 24, 2023, 6:02pm UTC](https://forum.inductiveautomation.com/t/custom-menu-using-named-query/65771/43 "2023-05-24T18:02:52Z")

</div>

> [@lrose](#):
>
> If the binding is set to poll, then this isn’t an issue.

> [@nminchin](#):
>
> You don't really want 120 clients all set on query poll though, 99% of the time being wasteful. Well, it's probably not such a big burdon, but changes won't apply until it polls, so you'd want to set it fairly quick. I just don't like it personally

My understanding was that only one copy is polling on the gateway, and the clients view that.

If polling is on and two clients are looking at a table with data from the query, then the query is only polled once, not twice when polling the database. Or is that not right?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [May 24, 2023, 6:17pm UTC](https://forum.inductiveautomation.com/t/custom-menu-using-named-query/65771/44 "2023-05-24T18:17:36Z")

</div>

> [@zacharyw.larson](#):
>
> Or is that not right?

That isn't right.

- If the binding is on a session property, then it would be 1 poll for every client session.
- If the binding is on a view property, then it would be 1 poll for every client with that view open. (I believe).
- If it is a query tag _ **then** _ it would be on the gateway and there would only be 1 poll for the system.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [May 24, 2023, 8:28pm UTC](https://forum.inductiveautomation.com/t/custom-menu-using-named-query/65771/45 "2023-05-24T20:28:53Z")

</div>

You're forgetting about cached named queries which I don't really use, since most of my named queries use parameters which mean caching is almost always defeated, unless clients happen to pick the exact same parameters within the cache period, very unlikely. However, if the params are all the same or you don't have params, then it's probably fairly close to polling once with the other clients reading the cache

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [May 25, 2023, 1:03pm UTC](https://forum.inductiveautomation.com/t/custom-menu-using-named-query/65771/46 "2023-05-25T13:03:57Z")

</div>

> [@nminchin](#):
>
> You're forgetting about cached named queries

I'm in the same boat as you, which is why I didn't think about it.

[Previous page](https://forum.inductiveautomation.com/t/custom-menu-using-named-query/65771.md?page=2)
