Apama 10.3.1 | Apama Documentation | Developing Apama Applications | Developing Apama Applications in Event Modeler | Using Functions in Event Modeler | About defining your own functions | Sample ABS function definition file
 
Sample ABS function definition file
Following is the function definition file for the absolute value (ABS) function. This function returns the absolute value of the given parameter. For example, if the input is -123, the ABS function returns 123.
Example
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE function SYSTEM "http://www.apama.com/dtd/fdf.dtd">
<!--Apama Function Definition File-->
<function name="ABS" display-string="ABS" return-type="float">
  <version>
    <id>1.0</id>
    <date>22 Nov 2004</date>
    <author>Matthew Amos</author>
    <comments>External function</comments>
  </version>
  <description>
    Return the abs value of the number passed
  </description>
  <parameters>
    <fixed-parameter name="value" type="float" />
  </parameters>
  <code><![CDATA[
    action #name#(float f) returns float {
      return f.abs();
    }
  ]]></code>
</function>
Notes
Notes for this function:
*The value of the function name attribute, ABS, is unique within the directory that contains this .fdf file.
*Appears as ABS in the Event Modeler rules menu.
*Returns a float.
*Metadata indicates who wrote the function and when the function was written.
*Description briefly describes what the function does.
*There is one parameter called value and it is of type float.
*Name of the single action is the placeholder #name#. This is always what you specify as the name of the function in the code element.
*The EPL in the CDATA section is standard EPL. You can use locally defined variables in addition to the function's parameters. To use a Scenario variable, assign its value to a function parameter.

Copyright © 2013-2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.