Using a Test Condition to Designate Optional Target Elements

A Test Condition controls the output of optional target elements that do not have a link from a source element or a literal. In the Test Condition link's Test field, you define a test expression under which the target element is created. In the transformation Map canvas, you can add a Test Condition node that can be linked to one or more targets.

To add a Test Condition:

  1. Double-click to expand the target schema node.

    The target schema node converts to a dialog containing its schema tree and all possible targets. You can resize this dialog.

  2. Right-click on the Map canvas and select Add Test Condition from the context menu.

  3. To link the Test Condition to one or more targets:

    1. Click the Test Condition node connection point, which is a yellow or green dot.

    2. Click directly on the target name, for example, Month12 [xsd:integer].

      A map link, which appears as a blue arrow, connects the Test Condition to the target.

  4. Click the Test Condition (test_n) node to edit the Test Properties in the Properties Panel view.

    Test properties

    FieldExplanation and options
    NameAutomatically named test_n. Edit as necessary.
  5. Click a Test Condition map link to edit the Link properties in the Properties Panel view:

    Link properties

    FieldExplanation and options
    Source test conditionDisplays the name of the literal node, for example, literal_4, as defined earlier in Literal properties.
    Target full path Displays a string identifying the target schema, element, and attribute (optional), for example, /sy2:OrderSummary/Sy2:OrderRef.
    Path FieldExplanation

    sy2

    An arbitrary namespace identifier.

    OrderSummary

    The name of the schema's root node.

    OrderRef

    The target, in this case, an element.
    Target relative path Displays a string identifying the target without the schema qualifier, for example, ../ParallelAttributeInSameElement.
    Test Enter the test condition that defines the condition on which the target is created.

    For example, /sy2:OrderSummary/Sy2:OrderRef!=" checks the presence of input values during runtime and omits the target in the resulting XML document if Sy2:OrderRef is empty (null).

Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com