mapslots/3—format a series of expressions that refer to objects into a  string


The mapslots/3 function formats a series of expressions that refer to objects into a string. The syntax for this function is as follows:

$STR=mapslots($OBJECTS,$EXPRS)

mapslots/3 arguments

Argument

Mode

Type

Description

$OBJECTS

Input

LIST_OF OBJECT

Specifies the list of event or data objects

$EXPRS

Input

LIST_OF STRING

Specifies the format and expressions to be evaluated

$STR

Output

STRING

Resulting string

Use the mapslots/3 to evaluate a list of expressions $EXPRS, referring to objects from $OBJECTS, and to format them into string $STR by using the first expression as format.

The format specification for mapslots/3 is the same as for the C language sprintf() function.

The first element from the list $EXPRS is taken as format. The rest of the expressions given in $EXPRS are compiled and evaluated at the moment the primitive is called, for each call again. Within these expressions, the objects from $OBJECTS can be referenced as $1, $2,... for the first, second,... element of the object list.

Warning

The values resulting from the evaluation of the expressions must be compliant with the specified format. Incompatible expression evaluation results can cause a crash of the cell.

mapslots/3 example

$STR = mapslots([$E,$D],
['Event %s is associated to data %s','$1.mc_ueid','$2.mc_udid']);

A message is produced stating that an event and data object are associated. The event and data object are passed as $E and $D, respectively, in the first argument. The list of expressions contains the format for the message, followed by two expressions that result in a string. The first one retrieves the mc_ueid slot of the event object, the second one retrieves the mc_udid of the data object.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*