Translate Data Within an Action

The amps-action-do-translate-data action allows you to translate the value from variables in the current context. One common use for this action is to translate a large number of status values into a smaller number of states before publishing that information in a message. For example, an order processing system may track a large number of finely-grained status codes, while the reporting view for customers may want to map those status codes to a smaller set of codes such as "pending", "shipped" and "delivered". This action allows you to easily translate those codes within AMPS.

When used to assemble a message, this action provides equivalent results to a set of nested conditional statements in a view projection. However, if you are using actions to parse, assemble and publish messages, this action gives you the ability to change values.

ParameterDescription

Data (required)

The data to translate. Most often, this is the value of a variable in the current context.

Value (required)

The variable to store the translated value in.

Case

A translation statement. The translation statement takes the form of original_value=translated_value.

This action allows you to provide any number of Case statements.

The action matches the Data provided to the original_value in each Case statement. When it finds a matching value, the action stores the translated value in the variable identified by the Value statement.

For example, the following translation statement translates a value of credit_check_in_progress to a value of pending.

 <Case>credit_check_in_progress=pending</Case> 

There is no default for this option.

Default

The default translation. AMPS sets the value of the variable to the contents of this element if no Case statement matches the Data provided.

This element is optional. If no Default is specified, AMPS uses the value of the original Data as the default translation.

Last updated

Copyright 2013-2024 60East Technologies, Inc.