< Previous | Next >

Adding the required elements to the custom visual snippet

When you have finished defining the inputs and output for the custom visual snippet, you must add the required elements.

In this topic, you learn how to add the required elements to the IsListEmpty custom visual snippet. When you have finished adding the elements, the visual snippet editor should resemble the following figure:


Picture of the visual snippet editor with the required elements added

To add the required elements to the custom visual snippet:

  1. Add the list variable:
    1. In the visual snippet editor tray, click the list input as shown in the following figure:
      Picture of the list input
    2. Hold the mouse button down on the list input and drag it to the upper left corner of the visual snippet editor canvas.
    3. Release the mouse button. The list input is added to the canvas.
    Note: When you add an element to the visual snippet editor canvas, you can hover over the element to display its properties in hover help text, as shown in the following figure:
    Picture of the hover help text for an element
  2. Add the size Java visual snippet to return the number of elements in the list:
    1. In the visual snippet editor palette, click the Java icon Picture of the Java icon. The Select a Java Visual Snippet window opens.
    2. In the Specify a type (? = any character, * = any String) field, type java.util.list.
    3. In the Matching types list, select List.
    4. In the Qualifier list, select java.util - installDir/runtimes/bi_v6/java/jre/lib/core.jar (where installDir is the install path of WebSphere Integration Developer).
    5. In the Select a visual snippet list, scroll down and select size().
    6. Click OK.
    7. Click the canvas under the list variable. The size Java visual snippet is added to the canvas.
    Note: You can add a Java visual snippet directly to the visual snippet editor canvas or you can add it to an existing element in the visual snippet editor canvas.
  3. Add the length expression:
    1. In the palette, click the Expression icon Picture of the Expression icon.
    2. Click the canvas under the size Java visual snippet. The expression is added to the canvas.
    3. In the expression, type length.
    Note: Expressions pass a variety of user-defined values to custom visual snippets. An expression can be visually composed using the expression builder.
  4. Add another length expression:
    1. In the palette, click the Expression icon Picture of the Expression icon.
    2. Click the canvas under the existing length expression. The new expression is added to the canvas.
    3. In the expression, type length.
  5. Add the equal to standard visual snippet:
    1. In the palette, click the Standard icon Picture of the Standard icon. The Add a Standard Visual Snippet window opens.
    2. In the Standard Visual Snippets list, expand the math folder and select equal to.
    3. Click OK.
    4. Click the canvas under the bottom length expression. The equal to standard visual snippet is added to the canvas.
    Note: Standard visual snippets are comprised of predefined visual snippets from the visual snippets library plus user-defined custom visual snippets. When you add a standard visual snippet to the visual snippet editor canvas, you will find that you cannot edit a predefined visual snippet from the visual snippets library but you can edit a user-defined custom visual snippet by double-clicking it.
  6. Add the 0 (zero) expression:
    1. In the palette, click the Expression icon Picture of the Expression icon.
    2. Click the canvas under the equal to standard visual snippet. The expression is added to the canvas.
    3. In the expression, type the number 0.
  7. Add the return node to return the result for the custom visual snippet:
    1. In the palette, click the Return icon Picture of the Return icon.
    2. Click the canvas area under the 0 expression. The Return node is added to the canvas.
The required elements have now been added to the custom visual snippet.

Feedback
(C) Copyright IBM Corporation 2005, 2006. All Rights Reserved.
< Previous | Next >