# Loop Mode Script Issue

**URL:** <https://forum.inductiveautomation.com/t/loop-mode-script-issue/113186>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [January 9, 2026, 7:52pm UTC](https://forum.inductiveautomation.com/t/loop-mode-script-issue/113186 "2026-01-09T19:52:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevin.tate](https://avatars.discourse-cdn.com/v4/letter/k/e99b99/32.png) [@kevin.tate](https://forum.inductiveautomation.com/u/kevin.tate)\
**Post date:** [January 9, 2026, 7:52pm UTC](https://forum.inductiveautomation.com/t/loop-mode-script-issue/113186/1 "2026-01-09T19:52:18Z")

</div>

We are trying to configure a label to output the current in-mode of a loop as feedback back to the user which exists in a UDT popup. The label contains a script that is supposed to look at three tag paths and determine what to show the user based on these paths, but it lacks the ability to update in real-time. Currently the method is only called in the startup event of the label. Ideally it should be set to update within a specified interval to give better/more up-to-date feedback. We have considered putting the custom method in the gateway, but this would complicate the transfer of data between the gateway and the label. What is the most effective way to go about getting the label to correctly display the in-mode of the loop in real-time?

Script:

**`def`** ` method_loop_mode(self, text):`  
` autoBit = self.view.params.Loop_auto_mode.value`  
` cascadeBit = self.view.params.Loop_cascade_mode.value`  
` manualBit = self.view.params.Loop_manual_switch.value`  
` output = " "`  
` `  
` ` **`if`** ` manualBit == 1:`  
` output = "Manual"`  
` ` **`elif`** ` autoBit == 1:`  
` output = "Auto"`  
` ` **`elif`** ` cascadeBit == 1:`  
` output = "Cascade"`  
` ` **`else`** `:`  
` output = "Manual"`  
` `  
` self.props.text = output`  
_`#print output`_

One possible solution we have investigated using is the perspective refresh function or alternatively a timer script which may allow for the periodic updates to the label. These may be work but we’d like to avoid potential additional overhead that this may introduce after the pop-up has been closed.

Any help is greatly appreciated!

Edit: The case statement worked but we did have to add additional cases for other possible combinations.

---

<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:** [January 9, 2026, 7:58pm UTC](https://forum.inductiveautomation.com/t/loop-mode-script-issue/113186/2 "2026-01-09T19:58:41Z")

</div>

The most common cause of this phenomenon with popups is passing a UDT **value** to the popup instead of a string tagpath parameter. The popup needs its own indirect tag bindings to the tags of interest (typically in custom props) in order to have live data.

(While IU teaches it, using UDT properties in your UIs is a terrible practice.)

---

<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:** [January 9, 2026, 8:01pm UTC](https://forum.inductiveautomation.com/t/loop-mode-script-issue/113186/3 "2026-01-09T20:01:16Z")

</div>

Also don't use a script. Use an expression binding.

```python
case(
    binEnc(self.custom.manual, self.custom.auto, self.custom.cascade),
    1, "Manual",
    2, "Auto",
    4, "Cascade",
    "Manual"
)
```

---

<div class="post-metadata">

**Author:** ![kevin.tate](https://avatars.discourse-cdn.com/v4/letter/k/e99b99/32.png) [@kevin.tate](https://forum.inductiveautomation.com/u/kevin.tate)\
**Post date:** [January 9, 2026, 8:31pm UTC](https://forum.inductiveautomation.com/t/loop-mode-script-issue/113186/4 "2026-01-09T20:31:39Z")

</div>

We had already configured this to use tag path parameters which allowed the case expression to work properly. It’s a good reminder of best practice for UDTs.

---

<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:** [January 9, 2026, 8:41pm UTC](https://forum.inductiveautomation.com/t/loop-mode-script-issue/113186/5 "2026-01-09T20:41:28Z")

</div>

Consider using `binEnum()` instead of `binEnc()` for your use-case. Can handle multiple true bits the way your script transform did.
