tlemar Posted November 20, 2008 Share Posted November 20, 2008 I am trying to call a function from a channel event. Here is the function and the calling event: Function Function rtnRadioStatus(RadioValue) Static RadioStatus Static string RadioStatusColor switch case (RadioValue == 0) RadioStatus = "Unavailable" RadioStatusColor = "Yellow" case (RadioValue == 128) RadioStatus = "Normal" RadioStatusColor = "Green" case (RadioValue > 128) RadioStatus = "Error" RadioStatusColor = "Red" endcase return(RadioStatus + "|" + RadioStatusColor) EndFunction Calling Parameter Static Temp Static TNum Temp = rtnRadioStatus(value) //This is line 4 TNum = find(Temp, "|", 1) TS_RadioStatus[1] = left(Temp,TNum) TS_RadioStatusColor[1] = mid(Temp,TNum,GetLength(Temp)) Returns the following error: C1000 Channel or function not found: Line 4 I have tried to do the same thing from a sequence with the same result. Any help would be apprecriated. Thanks Tracy Link to comment Share on other sites More sharing options...
AzeoTech Posted November 20, 2008 Share Posted November 20, 2008 "value" is a keyword that is only available from a Conversion. In the event, you'll need to specify the channel by name (and probably with a [0] afterwards to just get the most recent value) Link to comment Share on other sites More sharing options...
tlemar Posted November 20, 2008 Author Share Posted November 20, 2008 I fixed the 'value' issue but I am still getting the same error. I even tried using a hardocoded value (ie, 128 instead of TS01_RadioQuality[0]) with the same result. It does not seem to be recoginizing the function. Do I have to define it or put it in a special sequence or class? Does the sequence it is in need to "run at startup"? I know I can using sequences and global variables, but using a function would produce better code. Thanks for you assistance. Tracy Link to comment Share on other sites More sharing options...
AzeoTech Posted November 20, 2008 Share Posted November 20, 2008 Try declaring the variables as globals. Also try renaming Temp to something else. Link to comment Share on other sites More sharing options...
tlemar Posted November 20, 2008 Author Share Posted November 20, 2008 No luck. Do you happen to have a working example I could look at? Do I have to declare the passing variable some place or is it like vb where putting it in the function definition declares it. Link to comment Share on other sites More sharing options...
AzeoTech Posted November 21, 2008 Share Posted November 21, 2008 Sorry, I should have looked closer at your script: 1) you should use "private" in your declaration, not static. Statics are a rather special type of variable that I'm not sure anyone really uses. Its use is a bit advanced. 2) Radiostatus in your function needs to be declared as a string like the other variable 3) Temp also needs to be declared as a string Link to comment Share on other sites More sharing options...
tlemar Posted November 22, 2008 Author Share Posted November 22, 2008 That worked. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.