CH2014 Posted September 14, 2014 Share Posted September 14, 2014 Hi, 2 questions: - 1. I have 750 alarms all set to priority: Log, so no alarms are displayed in the alarm window as expected, which is fine. However I do notice that a momentary ghost image of an empty table keeps trying to display every few seconds. Is this normal? 2. As mentioned above, I have 750 alarms and I need to edit all the fire events. The change is exactly the same for all 750. Is there a quick way to do this or is it a case of very slowly going through each alarm config an editing individually. Link to comment Share on other sites More sharing options...
AzeoTech Posted September 14, 2014 Share Posted September 14, 2014 1. That is probably normal. It's just refreshing, but since all your alarms are log, nothing displays. 2. No, there is no way to edit them all. Really this is a good lesson for you: if you are cutting and pasting code, you should always think: "I should use a function instead". So, instead of making the change, figure out how you can replace all 750 scripts with a call to a function, then do all the work in the function. That way, if you need to make a change down the road, all you'll need to do is change the function. Link to comment Share on other sites More sharing options...
CH2014 Posted September 15, 2014 Author Share Posted September 15, 2014 Thank you, I'll change it to a function. Link to comment Share on other sites More sharing options...
CH2014 Posted September 17, 2014 Author Share Posted September 17, 2014 Hi, Following on from the above. I have put the following code in an alarm Fire Event: - ////////////////////////////////////////// AlarmFireEvent() ///////////////////////////////////////// I have created a function in the sequences as follows: - ///////////////////////////////////////////////////////////////////////////////////////////////////// function AlarmFireEvent() if(AlarmGoToOverview) //AlarmGoToOverview controlled by pushbutton on set up page page.strCurrentPage = "Overview" endif return 0 //////////////////////////////////////////////////////////////////////////////////////////////////////// The above all works great. I just want to double check that its okay within DAQFactory to have Functions that don't receive values and don't return values. The above works with the "return 0" omitted. Is it a good idea to leave it in? Link to comment Share on other sites More sharing options...
AzeoTech Posted September 18, 2014 Share Posted September 18, 2014 Absolutely. And you don't need the return. "Function" is more a matter of how its called, not the formatting. If you do: mySequence() then its called as a function and runs in the thread of the calling script. If you do: beginseq(mySequence) then it starts it own thread, and runs concurrently with the calling script. The function does not have to return a value. If you were to assign the result to a variable, that variable would just be empty. BTW: you don't even need the "function AlarmFireEvent()" at the top. Really you only need function declarations when you want to pass parameters and give those parameters names, and in classes. Link to comment Share on other sites More sharing options...
CH2014 Posted September 18, 2014 Author Share Posted September 18, 2014 Thank you Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.