A.5.2. Auto Node Type

Engineering Knowledge Manager

User's Guide | Appendix A. Defining a Process Template Using XML | A.5. Defining Nodes |

A.5.1. Node Type |  | A.5.3. Iteration Node Type
Prev |  | Next

### A.5.2. Auto Node Type

An auto node can be used to execute an automated step in a process. You provide the logic for the automated step in a macro. Refer to Defining Scripts Using a Supported Scripting Language for details on defining macros in EKM.

An auto node has the following required attributes:

`name`

  specifies the name of the auto node. This will be displayed in the graph and the Elements tree. Same restrictions apply as for Node Type.

`description`

  specifies a description of the node.

`assignee`

  specifies the EKM user session in which the automated task will run. To run it in the session of the process creator, set the value to `ProcessCreator`. To run it in the session of the previous node's assignee, set the value to `PreviousNodeAssignee`. Note that 'previous node' refers to the node that initiates the auto node.

The auto node definition has the following optional attribute:

`macro`

  This attribute specifies the name of the macro that defines the logic needed to be executed. If this attribute is not specified then the auto node does nothing and immediately proceeds to the next steps. This can be useful in the following situations:

  - Because processes and blocks must contain one and only one end node, you may need to use the auto node for meeting this restriction. For example suppose your process contains three nodes: A, B and C with transitions going from A to B and A to C. After node A, either node B or C is executed and the process completes when either B or C is completed. However, because the process must contain exactly one end node, you can create an auto node D that does nothing, and define transitions from B to D and C to D.

  - There may be scenarios where you want the process to wait for concurrent activities to complete before making a decision on the next paths to take. You can use an auto node to model this wait stage. The auto node does nothing and simple waits for all the preceding paths to complete. Then, using trigger expressions on the transitions leading out from the auto node, you can decide the next paths to take.

  If you do specify a macro for an auto node, you must follow these rules while defining the macro:

  - The macro must not contain any arguments

  - The macro can directly access any process variable as a global variable

  - If the macro needs to change the value of a process variable, it should return a map of variable names and their new values. If it does not need to change the value of any variable; it can simply return null.

  The following listing shows the example of an auto node macro. This macro is accessing the process variables `v1` and `v2` (that are of either `Long` or `Double` type), adding them up and setting the result as the value of another variable `v3`. Because this macro is changing the value of a variable, it returns a map containing the name of `v3` and its new value.

      add() {
         result = new HashMap();
         result.put("v3", v1+v2);
         return result;
      }

The auto node has the following optional child elements:

`inputVar`

  This element has two attributes `processVarName` and `itemVarName`. There may be situations when you want to define a macro that is used by more than one auto node in a process, or by auto nodes in more than one process. Because auto nodes require variable values to execute the logic and because the variable names may be different in different contexts, you may want to define the macro using a particular set of variable names. The `inputVar` element can be used to providing a mapping between the names of variables in the process (`processVarName`) and the names of variables used by the macro (`itemVarName`). You can specify any number of `inputVar` elements.

`outputVar`

  is used when you may want the auto node to set the values of process variables after execution. Similar to the `inputVar` element, `outputVar` has two attributes `processVarName` and `itemVarName`. You can specify any number of `outputVar` elements.

The following XML code is example of an auto node named `Add Node` that calls the add macro defined above.

Example 7: Auto Node

    <auto-node name="Add Node" description="" macro="add" />

Contains proprietary and confidential information of ANSYS, Inc. and its subsidiaries and affiliates.

Prev | Up / Contents | Next

Release 18.2 - © ANSYS, Inc. All rights reserved.