Hello,
I am trying to highlight sensors (background color) which has incomplete components in it.
When a user is selected from the dropdown, the highlight should happen
The window has a dropdown of all the usersnames and a template repeater with 10 instances of the sensors and I have added the script in property change event but it is not working
Your whole script needs to be nested in this way:
if event.propertyName == 'selectedStringValue':
#Indent all of your code one indention and nest it here
Otherwise, any and all properties that change will fire this script causing it to run multiple times when the selections change and causing it to run unexpectantly when other properties change.
If that doesn't fix your issue, paste your code into the post, then highlight the code, and click this button:
That will make your code copy and paste-able, which makes it easier for us evaluate your code for other problems.
Looking at your picture a little closer, my guess is that your script should be refactored to look more like this:
if event.propertyName == 'selectedStringValue':
selected_user = event.newValue
sensorRepeater = system.gui.getParentWindow(event).rootContainer.getComponent('Template Repeater')
if selected_user == 'ALL INCOMPLETE COMPONENTS'
#Primary Query Here
else:
#Alternate Query Here
for sensor in sensorRepeater.loadedTemplates:
#
# Put All Evaluate hasIncompleteTasks bool logic Here
#
if hasIncompleteTasks:
sensor.background = system.gui.color('red')
else:
sensor.background = system.gui.color('white')