Data Modification Action Language

Data Modification Action Language is used to define functions for use with Data Modification service actions in Tracking Analyst. A function acts to modify a data message when the Data Modification action is triggered. Any function defined using the Data Modification Action Language is provided with the values of the fields in the data message as input. All fields with a supported data type are provided for use in the function. To output its results, the function replaces the values in one or more of the fields in a data message. To perform calculations, the language provides basic arithmetic commands, as well as a few advanced mathematical functions.

Data Modification Action Language Structure

The following sections describe the details required for effective use of the Data Modification Action Language.

Supported Data Types

These are the basic data types that the language understands:

  • Integer Number (Example: 14)
  • Real Number (Example: 3.1452)
  • Text (Example: Anderson)
  • Date (Example: 12/12/2009)

All variables defined in the function will be one of the data types listed.

Variables

When the function begins, all the fields in the data message are available as variables with the same name as the field. Other variables are created the first time they are referenced. For example, a statement such as this creates a new variable:

NewLatitude = OldLatitude

If the variable NewLatitude does not exist and has never been used before, it will be created with the same data type as the variable OldLatitude. Note that changing the value of one of the data message variables will not change the value in the message itself. Refer to the Replace Statement to find out how to do this.

Because variable names are case sensitive, you must be very careful to check the capitalization of field names that appear in your function. You must also be sure to be consistent with the capitalization used in variables that you define.

Basic Assignment Statements

Assignment statements set the value of a variable to that of another variable or an expression. An equals sign ( = ) separates the variable from the source. Expressions in Data Modification Action Language are similar to those of other programming languages and can consist of variables separated by mathematical operators (+, -, *, /). Parentheses can be used to specify the evaluation order of the operators. Here are some examples of valid assignment statements:

  • NewLatitude = OldLatitude (This creates a new variable and assigns it the same value as an existing variable.)
  • TempString = "This is a string" (This explicitly assigns a value to a variable.)
  • A = B * 5.56 (This assigns a variable to the result of a mathematical operation involving another variable.)
  • Result = (4 * A) + 6 * (C + D) (This assigns a variable to the result of a more complex mathematical operation involving several variables.)

Math Functions

Special functions are available to perform common mathematical and shape manipulation operations. Here is a list of the available functions:

  • Arcsin (Inverse sine)
  • Arccos (Inverse cosine)
  • Arctan (Inverse tangent)
  • Sin (Sine)
  • Cos (Cosine)
  • Tan (Tangent)

Replace Statement

The replace statement is used to change the fields in a data message. Here are a couple of examples of the use of the replace statement:

  • Replace MSG_LAT with NewLatitude
  • Replace WIND_SPD_MPH with WindSpeedKPH * 1.609

Comments

Comments allow the user to include descriptive text information in a function without affecting the results of the function. There are several characters that can be used to designate comments in Data Modification Action Language:

  • //
  • !
  • REM
  • '

Example Function

The following example function is provided to get you started:

This function converts latitude and longitude values in a data message from decimal degrees to decimal seconds.

// Copy Data Message Fields
OldLatitude = MSG_LAT
OldLongitude = MSG_LON

// Perform Conversion
NewLatitude = OldLatitude * 60.0
NewLongitude = OldLongitude * 60.0

// Change Data Message
Replace MSG_LAT with NewLatitude
Replace MSG_LON with NewLongitude
// End

Thèmes connexes

4/26/2014