Funciton Issues


tlemar

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.