How can I create a Function instruction in an E3 script with an array?
Solution:
To do so, use a script similar to the one in the example below:
Sub CommandButton1_Click()
‘ Data operations sent at the Function
Dim value(3)
‘ Return of values used in the operation function
return = Operation (value)
MsgBox value(0)
MsgBox value(1)
MsgBox value(2)
MsgBox value(3)
End Sub
‘Function Declaration
Function Operation(value)
value(0) = Screen.Item(“sp1”).Value + Screen.Item(“sp2”).Value
value(1) = Screen.Item(“sp1”).Value – Screen.Item(“sp2”).Value
value(2) = Screen.Item(“sp1”).Value * Screen.Item(“sp2”).Value
value(3) = Screen.Item(“sp1”).Value / Screen.Item(“sp2”).Value
Operation = value
End Function
‘Used for eliminating last Sub’s function
Sub Empty()
End Sub