Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

CicodeCallReturn

  • Last UpdatedJul 18, 2023
  • 2 minute read

The CicodeCallReturn function is used to obtain the return value of the most recently completed Cicode function opened and run with the VBA CicodeCallOpen function.

No arguments are passed to the CicodeCallReturn function, as it will return the result of the most recent return-value for the Cicode function called by the VBA CicodeCallOpen function.

The CicodeCallReturn function should be used in its own separate line of VBA code and must not be nested with the CicodeCallOpen function. For details, see Calling Cicode from VBA in the topic Using VBA in Command or Expression Fields.

Syntax

ReturnValue = CicodeCallReturn()

ReturnValue:

The return value of the Cicode function specified in the most recent call of the CicodeCallOpen function. Note that the return data type of CicodeCallReturn will depend upon the return data type of the completed Cicode function most recently called by the CicodeCallOpen function.

Return Value

CicodeCallReturn returns the return-value of the completed Cicode function most recently called by the CicodeCallOpen function.

CicodeCallOpen

Example

' declare modular variant variable to store function results

Dim vntRet as Variant

Function TestCicode() As Integer

' declare local variables

Dim intRet As Integer

Dim strReply as String

Dim intMaxScale as Integer

' copy current tag value to variable

' uses the project variable tag named MAX_SCALE

intMaxScale = MAX_SCALE

' call Cicode function

' for example: TrnSetScale( AN, Pen, Percent, Scale)

intRet = CicodeCallOpen( "TrnSetScale", 53, -1, 100, (IntMaxScale)

)

' Note the syntax used:

' - brackets around the VBA function argument list

' - double quotes around the Cicode function name

' - no brackets around the Cicode function argument list

' - brackets around individual variable arguments

' test results

If intRet = 0 Then

'

' insert code for successful completion here

'

vntRet = CicodeCallReturn()

strReply = "CicodeCallOpen Function successfully called"

Else

'

' insert code for unsuccessful completion here

'

Select Case intRet

Case = 1

' assign return comment for this case

strReply = "CicodeCallOpen Function call error (unsuccessful)"

Case = 2

' assign return comment for this case

strReply = "Cicode Function not found"

Case = 3

' assign return comment for this case

strReply = "Wrong number of arguments "_

& "in Cicode CallOpen function call"

Case Else

' assign return comment for this case

strReply = "Unknown error"

End Select

End If

' display return comment for your information

MsgBox strReply

' assign return value for this function

TestCicode = intRet

End Function

In This Topic
TitleResults for “How to create a CRG?”Also Available in