jrbusch Posted April 11, 2014 Share Posted April 11, 2014 Hi, I am using a sequence to update some component parameters on a page. Basically there is a button to toggle the page between showing data from channels 1 to 20 or data from channels 21 to 40. The button runs this sequence: if(alarmPage == 1) alarmPage = 2 for(i=1, i<21, i++) // Update RIU Names execute("component.RIU"+i+"_NAME.strExpression= 'registry.strRIU"+i+"'") execute("component.RIU"+i+"_NAME.strVisible = '~registry.L1_RIU"+i+"_Show_hide_RIU'") // Update Alarm Low/High execute("component.RIU"+i+"_LOW.strExpression = 'Var.alarm"+i+"low'") execute("component.RIU"+i+"_HI.strExpression = 'Var.alarm"+i+"high'") endfor else alarmPage = 1 for(i=1, i<21, i++) // Update RIU Names execute("component.RIU"+i+"_NAME.strExpression= 'registry.strRIU"+(i+20)+"'") execute("component.RIU"+i+"_NAME.strVisible = '~registry.L1_RIU"+(i+20)+"_Show_hide_RIU'") // Update Alarm Low/High execute("component.RIU"+i+"_LOW.strExpression = 'Var.alarm"+(i+20)+"low'") execute("component.RIU"+i+"_HI.strExpression = 'Var.alarm"+(i+20)+"high'") endfor endif I am finding that when I press the toggle button, about half of the time it functions properly, but the other half of the time, some of the parameters are just not updated. This seems completely random and can vary from just one single parameter not updating to 3/4 of them not updating. It seems like sometimes some of the execute statements are not completing for some reason. Any ideas? Thanks, Rob Link to comment Share on other sites More sharing options...
AzeoTech Posted April 11, 2014 Share Posted April 11, 2014 I'm assuming that's not all the sequence and you have i declared somewhere. Do you get any alerts in the command / alert? Does it stop half way, or is the update random? i.e. do components 1-8 update but not 9-20, or is it more random? Link to comment Share on other sites More sharing options...
jrbusch Posted April 11, 2014 Author Share Posted April 11, 2014 Hey Guru, You're right, I was using a global i for some silly reason. I changed it to declare i private within the sequence and problem solved. Thanks! Link to comment Share on other sites More sharing options...
AzeoTech Posted April 11, 2014 Share Posted April 11, 2014 Yeah, that would do it! Some other thread must have been changing i at the same time. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.