# Perspective struggle with 3 dependent dropdowns

**URL:** <https://forum.inductiveautomation.com/t/perspective-struggle-with-3-dependent-dropdowns/72962>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [April 27, 2023, 1:14pm UTC](https://forum.inductiveautomation.com/t/perspective-struggle-with-3-dependent-dropdowns/72962 "2023-04-27T13:14:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hewking32](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hewking32](https://forum.inductiveautomation.com/u/hewking32)\
**Post date:** [April 27, 2023, 1:14pm UTC](https://forum.inductiveautomation.com/t/perspective-struggle-with-3-dependent-dropdowns/72962/1 "2023-04-27T13:14:22Z")

</div>

Hi All  
I would like to have 3 dependent dropdowns ie. first dropdown allows selection from the dataset from the db, then second dropdown filters further based on selection from the first dropdown - same applies to dropdown 3 which filters based on the selection of 2 previous dropdowns.

The code works rather slowly only when cyclic refresh to the custom property pulling data from the db is enabled. This custom property with the dataset is on the root level.

How can i make my code event based without cyclic polling?

Dataset is pulled from the named query without any parameters needed and is further processed using transform script.  
I am using options property binding from the dropdowns to the dataset.

Regards

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [April 27, 2023, 1:56pm UTC](https://forum.inductiveautomation.com/t/perspective-struggle-with-3-dependent-dropdowns/72962/2 "2023-04-27T13:56:46Z")

</div>

> [@hewking32](#):
>
> How can i make my code event based without cyclic polling?

Turn polling off, then whatever you want to trigger a binding refresh, use `refreshBinding`

```auto
self.getSibling("dropdown").refreshBinding("props.options")

```

---

<div class="post-metadata">

**Author:** ![Jordan\_Mungo](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@Jordan\_Mungo](https://forum.inductiveautomation.com/u/Jordan_Mungo)\
**Post date:** [April 27, 2023, 1:56pm UTC](https://forum.inductiveautomation.com/t/perspective-struggle-with-3-dependent-dropdowns/72962/3 "2023-04-27T13:56:51Z")

</div>

If I understood correctly, you want your dataset to be collected and then you don't want it to keep refreshing itself?

I would setup a message handler using system.perspective.sendMessage() on your view that you send when the view is opened, or any other time you find it necessary.

Then in your message handler you can use the system.db.runNamedQuery() function in the script and assign the result to your custom property.

This way lets you refresh the information exactly when you want.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [April 27, 2023, 2:02pm UTC](https://forum.inductiveautomation.com/t/perspective-struggle-with-3-dependent-dropdowns/72962/4 "2023-04-27T14:02:55Z")

</div>

Instead of running the query in the message handler, I think it would be cleaner to set up a query binding and call `refreshBinding` from the handler.

---

<div class="post-metadata">

**Author:** ![hewking32](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hewking32](https://forum.inductiveautomation.com/u/hewking32)\
**Post date:** [April 27, 2023, 2:23pm UTC](https://forum.inductiveautomation.com/t/perspective-struggle-with-3-dependent-dropdowns/72962/5 "2023-04-27T14:23:46Z")

</div>

thanks for reply.  
So in my example of 3 dropdowns where to i need to put the refresh call ? My understanding is that when the selection on 1st dropdown is made it should refresh the options property on the 2nd dropdown. So do i put the refreshBinding("2ndDropdown.prop.options") call in the "value" property of the first Dropdown? Should it be expression type binding?  
Regards

---

<div class="post-metadata">

**Author:** ![hewking32](https://avatars.discourse-cdn.com/v4/letter/h/b5ac83/32.png) [@hewking32](https://forum.inductiveautomation.com/u/hewking32)\
**Post date:** [April 27, 2023, 2:37pm UTC](https://forum.inductiveautomation.com/t/perspective-struggle-with-3-dependent-dropdowns/72962/6 "2023-04-27T14:37:46Z")

</div>

On first dropdown i created event onActionsPerformed and from there i used the code self.getSibling("2ndDropdown").refreshBinding("props.options").  
I hope that is what you meant ? @dkhayes117  
It works a lot faster as its event based 🙂

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [April 27, 2023, 3:04pm UTC](https://forum.inductiveautomation.com/t/perspective-struggle-with-3-dependent-dropdowns/72962/7 "2023-04-27T15:04:37Z")

</div>

You don't need to refresh the dropdowns' bindings.  
Simple bindings don't usually need to be refreshed.

What might need to be refreshed, is a table displaying the data, if your dropdowns are acting as filters.  
And even that might not need to be manually refreshed.

Tell us more about what you're trying to do, so we can properly help you find a proper solution.
