# configureEditor on a powertable with multiple conditions

**URL:** <https://forum.inductiveautomation.com/t/configureeditor-on-a-powertable-with-multiple-conditions/77017>\
**Category:** Ignition\
**Tags:** ignition81, vision, scripting\
**Created:** [July 27, 2023, 2:29pm UTC](https://forum.inductiveautomation.com/t/configureeditor-on-a-powertable-with-multiple-conditions/77017 "2023-07-27T14:29:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christopher\_Gehle](https://avatars.discourse-cdn.com/v4/letter/c/4bbf92/32.png) [@Christopher\_Gehle](https://forum.inductiveautomation.com/u/Christopher_Gehle)\
**Post date:** [July 27, 2023, 2:29pm UTC](https://forum.inductiveautomation.com/t/configureeditor-on-a-powertable-with-multiple-conditions/77017/1 "2023-07-27T14:29:32Z")

</div>

Hello,  
I am working on a powertable and trying to configure columns. some have options to create a dropdown, one is a text field. The text field and dropdown worked fine at first, but once I added another with conditions everything went bad and now only shows my first return as options for all editable fields. I need to have multiple options based on a dropdown on the screen, but so far this isn't working. Any help would be appreciated.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/7/376ee590ab9136ef9965960b7cd46945815f3e54.png)

---

<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:** [July 27, 2023, 2:52pm UTC](https://forum.inductiveautomation.com/t/configureeditor-on-a-powertable-with-multiple-conditions/77017/2 "2023-07-27T14:52:43Z")

</div>

Your syntax for additional conditions in if/else if is wrong.  
Line 6 needs to be either:  
`if colName in ('COMP 1 LEVEL', 'COMP 2 LEVEL')`  
Or  
`if colName == 'COMP 1 LEVEL' or colName == 'COMP 2 LEVEL'`  
Similar issues on line 10 and 13 with the `and`.

What's happening now is the literal string `COMP 2 LEVEL` on line 6 is evaluating true as the second check, ending up always evaluating that if block as true.

---

<div class="post-metadata">

**Author:** ![Christopher\_Gehle](https://avatars.discourse-cdn.com/v4/letter/c/4bbf92/32.png) [@Christopher\_Gehle](https://forum.inductiveautomation.com/u/Christopher_Gehle)\
**Post date:** [July 27, 2023, 3:38pm UTC](https://forum.inductiveautomation.com/t/configureeditor-on-a-powertable-with-multiple-conditions/77017/3 "2023-07-27T15:38:02Z")

</div>

Okay. I believe I understand. For Lines 8-12. Do I need to do something else to get it to switch to the second set of options whenever my dropdown changes string values? right now it is only switching when I go from preview to design mode and then back to preview. The comp level values are holding strong the whole time, so I believe this part is corrected.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/5/95d3ca827d4a9f974c6192ca70ee43a67b3f79d3.png)

---

<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:** [July 27, 2023, 3:58pm UTC](https://forum.inductiveautomation.com/t/configureeditor-on-a-powertable-with-multiple-conditions/77017/4 "2023-07-27T15:58:37Z")

</div>

Just a note, that

```auto
colName in ('POSITION')

```

is not the same as

```auto
colName in 'POSITION'

```

The first is looking for a string in a sequence and will return false if `colName` is not `'POSITION'`.  
The second is looking for a string or substring match in the literal string `'POSITION'` so if your column name was any of P,PO, OSI, etc.. it will return true.

---

<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:** [July 27, 2023, 4:00pm UTC](https://forum.inductiveautomation.com/t/configureeditor-on-a-powertable-with-multiple-conditions/77017/5 "2023-07-27T16:00:27Z")

</div>

`colName in 'POSITION'` (probably) isn't quite right - you're saying "return True if the string `POSITION` _contains_ my current column name. So a column name of `POS`, `IT`, `TION`, etc would all return true for that check. You probably want a simple equality check there.

As an aside, some of your repetitive options creations can be simplified using list comprehensions:

```auto
options = [(it, str(it)) for it in (0, 10, 25, 50, 75, 100)]

options = [(it, str(it)) for it in xrange(18)]

options = enumerate(['0', '1', '2', '1V', '2V', '3V', '4V', '5V', '6V', '7V', '8V', '9V'])

```

---

<div class="post-metadata">

**Author:** ![Christopher\_Gehle](https://avatars.discourse-cdn.com/v4/letter/c/4bbf92/32.png) [@Christopher\_Gehle](https://forum.inductiveautomation.com/u/Christopher_Gehle)\
**Post date:** [July 27, 2023, 4:16pm UTC](https://forum.inductiveautomation.com/t/configureeditor-on-a-powertable-with-multiple-conditions/77017/6 "2023-07-27T16:16:20Z")

</div>

I did fix my position string to be ('POSITION') but let me explain a little better. Both sets come up based on my dropdown selection, but if I have 721 chosen first then switch to 722 it will keep 721's list of options. But if I go back and forth from preview to design and then back, it will then switch to 722's list. I am unsure of why. In the program I have to change screens for it to change list options under position after I choose a different option in the dropdown.  
721 selected  
 ![Screenshot (9)](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/7/f7d9c518e7d56fe4090e9361b8712752c7ba13b5.png)  
722 selected- get the same list  
 ![Screenshot (7)](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/6/66fd4e8146cfacc3acbad813284e9dee3ee39674.png)  
press stop to go back to design and then press play to go back to preview and 722's options then finally appear.  
 ![Screenshot (8)](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/f/cf0c61519e1871185f2fc486eda3779f2b6f32c0.png)  
In the actual program I have to change screens to get them to show up.

---

<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:** [July 27, 2023, 4:29pm UTC](https://forum.inductiveautomation.com/t/configureeditor-on-a-powertable-with-multiple-conditions/77017/7 "2023-07-27T16:29:31Z")

</div>

`configureEditor` doesn't fire all the time - it basically fires once, on initialization of the table. If you want more dynamic option support, you have to get a little more advanced with it. Let me dredge up some old sample code...

> [@Force configure cell update in power table](https://forum.inductiveautomation.com/t/force-configure-cell-update-in-power-table/16318/7):
>
> The much more efficient solution is to embed a custom editor, which will lookup the datasets dynamically whenever it’s appropriate. I’ve got a very simple example of this below; the project has an editable ‘Options’ dataset, and the available options in column B in the editable table will be dynamic based on the value in column A. The relevant code is here: root = self from javax.swing import JComboBox, DefaultCellEditor, DefaultComboBoxModel class CustomCellEditor(DefaultCellEditor):…

---

<div class="post-metadata">

**Author:** ![Christopher\_Gehle](https://avatars.discourse-cdn.com/v4/letter/c/4bbf92/32.png) [@Christopher\_Gehle](https://forum.inductiveautomation.com/u/Christopher_Gehle)\
**Post date:** [July 27, 2023, 5:18pm UTC](https://forum.inductiveautomation.com/t/configureeditor-on-a-powertable-with-multiple-conditions/77017/8 "2023-07-27T17:18:21Z")

</div>

I will dig into this. Thank you for the help.
