Skip to content

(Event Binding) Event actions

Stephan Stricker edited this page Jul 8, 2019 · 6 revisions

Event actions

Actions are executed when a trigger is fired. The following targets can be used for actions.


OPC UA variable

OPC variables are typically PLC variables. In most cases this variable is coming from the PLC but it can also be a remote OPC variable. Use ::Program:Variable1 for local variable and ::AsGlobalPV:Variable1.

  • SetValueBool
<Target xsi:type="opcUa.NodeAction" refId="::Program:Variable1" >
  <Method xsi:type="opcUa.NodeAction.SetValueBool" value="true" />
</Target>

Use false to reset the variable

  • ToggleValueBool
<Target xsi:type="opcUa.NodeAction" refId="::Program:Variable1" >
  <Method xsi:type="opcUa.NodeAction.ToggleValueBool"/>
</Target>
  • SetValueNumber
<Target xsi:type="opcUa.NodeAction" refId="::Program:Variable1" >
  <Method xsi:type="opcUa.NodeAction.SetValueNumber" value="37.1" />
</Target>
  • AddValue
<Target xsi:type="opcUa.NodeAction" refId="::Program:Variable1" >
  <Method xsi:type="opcUa.NodeAction.AddValue" value="2" />
</Target>
  • SetValueString
<Target xsi:type="opcUa.NodeAction" refId="::Program:Variable1" >
  <Method xsi:type="opcUa.NodeAction.SetValueString" value="Hello World" />
</Target>
  • SetValueDateAndTime
<Target xsi:type="opcUa.NodeAction" refId="::Program:Variable1" >
  <Method xsi:type="opcUa.NodeAction.SetValueDateTime" value="2018-02-23T09:33:30Z" />
</Target>
  • GetValue
<ReadTarget xsi:type="opcUa.NodeAction.Read" refId="::Program:Variable1" >
  <Method xsi:type="opcUa.NodeAction.GetValue" />
</ReadTarget>
  • GetServerStatus
<ReadTarget xsi:type="opcUa.SystemAction.Read" serverAlias="extern" >
  <Method xsi:type="opcUa.SystemAction.GetServerStatus" />
</ReadTarget>

Possible results are

* SERVER_STATUS_CONNECTED         0 Server connection established 
* SERVER_STATUS_CONNECTION_FAILED 1 Server connection failed 
* SERVER_STATUS_CONNECTION_LOST   2 Server connection unexpectedly lost (e. g. network error) 
* SERVER_STATUS_SHUTDOWN          3 Server connection disconnected, has been shut down 

Session variable

Session variables exist for each client connection as individual set of data.

  • SetValueBool
<Target xsi:type="session.VariableAction" refId="Variable1" >
  <Method xsi:type="session.VariableAction.SetValueBool" value="false" />
</Target>

Use false to reset the variable

  • ToggleValueBool
<Target xsi:type="session.VariableAction" refId="Variable1" >
  <Method xsi:type="session.VariableAction.ToggleValueBool" />
</Target>
  • SetValueNumber
<Target xsi:type="session.VariableAction" refId="Variable1" >
  <Method xsi:type="session.VariableAction.SetValueNumber" value="4.8" />
</Target>
  • AddValue
<Target xsi:type="session.VariableAction" refId="Variable1" >
  <Method xsi:type="session.VariableAction.AddValue" value="-4.8" />
</Target>
  • SetValueString
<Target xsi:type="session.VariableAction" refId="Variable1" >
  <Method xsi:type="session.VariableAction.SetValueString" value="Hello World" />
</Target>
  • SetValueDateAndTime
<Target xsi:type="session.VariableAction" refId="Variable1" >
  <Method xsi:type="session.VariableAction.SetValueDateTime" value="2018-02-23T09:33:30Z" />
</Target>
  • GetValue
<ReadTarget xsi:type="session.VariableAction.Read" refId="Variable1" >
 <Method xsi:type="session.VariableAction.GetValue" />
</ReadTarget>
  • Start (Timer)
<Target xsi:type="session.TimerAction" refId="RepetitivTimer" >
 <Method xsi:type="session.TimerAction.Start" interval="1000" />
</Target>
  • Stop (Timer)
<Target xsi:type="session.TimerAction" refId="RepetitivTimer" >
  <Method xsi:type="session.TimerAction.Stop" />
</Target>
  • IsRunning (Timer)
<ReadTarget xsi:type="session.TimerAction.Read" refId="RepetitivTimer" >
  <Method xsi:type="session.TimerAction.IsRunning" />
</ReadTarget>

Client System

Client variables are similar to session variables. The session variables represent the panel side of a session where the client variables represent the client side. Client variables can be browser information or IP address of the connected client. In this case the client is the source of the data. It can also be the target for example to show a dialog box.

  • OpenDialog
<Target xsi:type="clientSystem.Action">
    <Method xsi:type="clientSystem.Action.OpenDialog" dialogId="dialog1" horizontalPos="left" verticalPos="top" />
</Target>
  • CloseDialog
<Target xsi:type="clientSystem.Action">
    <Method xsi:type="clientSystem.Action.CloseDialog" dialogId="dialog1" />
</Target>
  • ShowMessageBox

MessageBoxType defines which buttons should be displayed in a message box. Possible values:
AbortRetryIgnore Shows buttons for aborting, retrying and ignoring.
OK Shows a button for confirmation.
OKCancel Shows buttons for confirmation and canceling.
RetryCancel Shows buttons for retrying and canceling.
YesNo Shows buttons for yes and no.
YesNoCancel Shows buttons for yes, no and canceling.\

MessageBoxIcon defines the icon to be displayed in a message box. Possible values:
Asterisk, Error, Exclamation, Hand, Information, None, Question, Stop, Warning

Action ShowMessageBox returns a result. This result is returned when the user presses a button in the open message box. The returned result is a value that identifies which button was pressed. Button ID Value
Yes 1
No 2
OK 4
Cancel 8\ Abort 16
Retry 32
Ignore 64

<!-- Open message OK />-->
<EventBinding>
	<Source xsi:type="opcUa.Event" refId="::AsGlobalPV:ArUser.VIS.ShowMessageBoxOK" event="ValueChanged" />
	<!-- Read value from PLC />-->	
	<Operand name="MessageBoxText" datatype="ANY_STRING">
		<ReadTarget xsi:type="opcUa.NodeAction.Read" refId="::AsGlobalPV:ArUser.DAT.Status" >
			<Method xsi:type="opcUa.NodeAction.GetValue" />
		</ReadTarget>
	</Operand>
	
	<EventHandler condition="newValue" >		
		<Action>					
			<Target xsi:type="clientSystem.Action">
				<Method xsi:type="clientSystem.Action.ShowMessageBox" type="OK" message="=MessageBoxText" header="Information" icon="Information"  />
			</Target>
			<Result>
				<ResultHandler condition="result = 4">
					<Action>					
						<Target xsi:type="opcUa.NodeAction" refId="::AsGlobalPV:ArUser.VIS.ShowMessageBoxOK" >
							<Method xsi:type="opcUa.NodeAction.SetValueBool" value="false" />
						</Target>
					</Action>
				</ResultHandler>
			</Result>
		</Action>
	</EventHandler>
</EventBinding>	
  • Action.Navigate
<Target xsi:type="clientSystem.Action"> <Method xsi:type="clientSystem.Action.Navigate" pageId="mainpage" /> </Target>
  • LoadContentInArea
<Target xsi:type="clientSystem.Action">
    <Method xsi:type="clientSystem.Action.LoadContentInArea" contentId="Content3" areaId="A1" pageId="MainPage" />
</Target>
The action returns the result for load successful
  • LoadContentInDialogArea
<Target xsi:type="clientSystem.Action">
    <Method xsi:type="clientSystem.Action.LoadContentInDialogArea" contentId="Content3" areaId="A1" dialogId="Dialog1" />
</Target>
The action returns the result for load successful
  • ChangeTheme
<Target xsi:type="clientSystem.Action">
    <Method xsi:type="clientSystem.Action.ChangeTheme" theme="MyNewTheme" />
</Target>
  • Login
<EventBinding>
    <Source xsi:type="opcUa.Event" refId="::Program:startLogin" event="ValueChanged" />
			
    <Operand name="user" datatype="ANY_STRING">
        <ReadTarget xsi:type="opcUa.NodeAction.Read" refId="::Program:user">
            <Method xsi:type="opcUa.NodeAction.GetValue" />
        </ReadTarget>
    </Operand>

    <Operand name="pwd" datatype="ANY_STRING">
        <ReadTarget xsi:type="opcUa.NodeAction.Read" refId="::Program:pwd">
            <Method xsi:type="opcUa.NodeAction.GetValue" />
        </ReadTarget>
    </Operand>

    <EventHandler condition="newValue = 1">
        <Action>
            <Target xsi:type="clientSystem.Action">
                <Method xsi:type="clientSystem.Action.Login" userName="=user" password="=pwd" />
            </Target>
        </Action>
    </EventHandler>
</EventBinding>
  • Logout
<Target xsi:type="clientSystem.Action"> 
  <Method xsi:type="clientSystem.Action.Logout"/> 
</Target>
  • SetLanguage
<Target xsi:type="clientSystem.Action">
    <Method xsi:type="clientSystem.Action.SetLanguage" value="en" />
</Target>
  • SetMeasurementSystem
<Target xsi:type="clientSystem.Action">
    <Method xsi:type="clientSystem.Action.SetMeasurementSystem" value="imperial" />
</Target>
  • ScrollContent
<Target xsi:type="clientSystem.Action">
    <Method xsi:type="clientSystem.Action.ScrollContent" contentId="Content2" position="top" duration="2000" />
</Target>
The action returns the result for load successful
  • OpenDialogAtTarget
<Target xsi:type="clientSystem.Action">
    <Method xsi:type="clientSystem.Action.OpenDialogAtTarget" dialogId="dialog1" horizontalPos="left" verticalPos="bottom" target="StartContent_Button1" horizontalDialogAlignment="left" verticalDialogAlignment="middle"/>
</Target>

Widget

These are actions that can be executed on widgets. See the Automation Studio help for details what events can be triggered by each widget.

<Target xsi:type="widgets.brease.Button.Action" contentRefId="Content1" widgetRefId="Button1" >
  <Method xsi:type="widgets.brease.Button.Action.SetEnable" value="true"/>
</Target>
Clone this wiki locally