This topic contains sections marked as revised for this release

WebSphere Message Brokers
File: ar25160_
Writer: Cerys Giddings

Task topic

This build: July 31, 2007 21:36:12

Creating and calling your own user-defined ESQL routine

For complex mappings you can create user-defined ESQL functions that can be called from the Message Mapping editor. This topic describes how to create a user-defined ESQL function and how to use it in an existing message map.
  1. Switch to the Broker Application Development perspective.
  2. Create a new ESQL file, or open an existing ESQL file.
  3. Enter your ESQL function in the ESQL file. Ensure that you do not enter the ESQL in any existing modules.
  4. Save the ESQL file.
  5. Right-click your Mapping node and click Open Map to open your message map in the Message Mapping editor.
  6. Select the target that you want to generate using your ESQL function from the appropriate target message or target database table.
  7. In the Edit pane, enter the expression to call the ESQL function and any parameters to pass to the function. For example:
    esql:concatValues($source/Pager/Text, ' Powered by IBM.')
    Where concatValues is the name of the user-defined ESQL function and the following parameters:
    • $source/Pager/Text is a field in the source message
    • ' Powered by IBM.' is text
    The following is the ESQL used for the user-defined ESQL function in the preceding example:
    CREATE FUNCTION concatValues(IN val INTEGER, IN str CHAR) RETURNS CHAR
    	BEGIN
    		return str || ' plus int val ' || CAST(val AS CHAR);
    	END;
    You can also use Edit > Content Assist to select user-defined ESQL functions. The user-defined ESQL functions are located at the end of the list of ESQL functions.
  8. Save the message map file by clicking File > Save.
Related concepts
Message Mapping editor
Message flows, ESQL, and mappings
Related tasks
Developing ESQL
Related reference
Message Mapping editor Spreadsheet pane
Message Mapping editor Edit pane
CREATE FUNCTION statement
Mapping node
Broker Application Development perspective
Notices | Trademarks | Downloads | Library | Support | Feedback

Copyright IBM Corporation 1999, 2007Copyright IBM Corporation 1999, 2007. All Rights Reserved.
This build: July 31, 2007 21:36:12

ar25160_ This topic's URL is: