Insert a Switch node

Important

This content is archived and is not being updated. For the latest documentation, see Microsoft Dynamics 365 product documentation. For the latest release plans, see Dynamics 365 and Microsoft Power Platform release plans.

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

The Switch node is useful when you have to test for several different outcomes of a certain variable. A Switch node is meaningless without one or more subnodes. The subnodes must be added manually. There are two node types that you can add to a Switch node:

Note

This information applies only to Product builder.

  • Case node – Specifies case values that should be compared to the switch value.

  • Default node – Specifies that none of the case values are equal to the switch value.

Insert a switch node as follows:

  1. Click Product information management > Common > Product builder > Product models.

  2. Double-click a product model.

  3. Click Product model.

  4. Select the Tree tab in the lower pane.

  5. Right-click the Modeling tree node.

  6. Click New > Switch node. A new node is added to the bottom of the modeling tree.

  7. To insert a node into a particular position in the tree, drag it from the node list displayed on the left.

  8. In the Description field in the Switch node form, describe what the Switch node does.

  9. In the Switch value field, select the switch value that will be compared to the case values defined in the subnodes for the Switch node.

  10. Click Test to test the code syntax.

  11. Click OK to save the code.

  12. To add one or more subnodes to the Switch node, right-click the Switch node and select New to add a Case node or Default node subnode.

    Note

    You can add multiple case nodes, but it is only necessary to add one or zero default nodes.

  13. Define the actions that will be performed by each node and subnode until your Switch node is complete.