Use AssignData to define a constant, assign a different value to a variable, perform a mathematical operation, or manipulate strings of characters. AssignData assigns the result of the requested operation to a variable.
AssignData can be used for incrementing a counter during loop processing (followed by an EvaluateData to check the value of the counter), when a variable must have a specific value before an action is performed, or when the value of one variable should be assigned to a different variable.
The parameters for AssignData identify an operation, the operands on which the operation is performed, and the variable to which the result is assigned. Operations that are performed on two values can be performed when the values are contained in variables, defined as constants, or a combination.
The parameters for AssignData are as follows:
For example, if Operand 1 is 10 and Operand 2 is 3, the Modulus operation calculates 10 divided by 3 = 3 remainder 1. Result is assigned a value of 1.
If Operand 2 is zero the result is Overflow.
For example, if Operand 1 is a variable with a value of -5 at this state, Absolute Value assigns a value of 5 to the variable identified as Result.
Truncate operates on numbers. If Operand 2 is positive, AssignData truncates the number at that digit place to the right of the decimal place. If Operand 2 is negative, AssignData rounds the number down at that digit place to the left of the decimal place.
For example, if Operand 1 is 345.678 and Operand 2 is 1, Result is assigned the value 345.6. If Operand 2 is -1, Result is assigned the value 340. If Operand 2 is 0, Result is assigned the value 345.
Round operates on numbers. If Operand 2 is positive, AssignData rounds the number at that digit place to the right of the decimal place. If Operand 2 is negative, AssignData rounds the number at that digit place to the left of the decimal place. AssignData rounds numbers ending in 5 to the next higher value.
For example, if Operand 1 is 135.789 and Operand 2 is 1, Result is assigned the value 135.8. If Operand 2 is -1, Result is assigned the value 140. If Operand 2 is 0, Result is assigned the value 136.
Concatenate is a string operation. If Operand 1 is a constant number, it treats the number as a string, not a mathematical value.
For example, if Operand 1 is "caller" and Operand 2 is 4, the value assigned to Result is "call."
Left is a string operation. If Operand 1 is a number, it treats the number as a string, not a numeric value.
For example, if Operand 1 is "telephone" and Operand 2 is 5, the value assigned to Result is "phone."
Right is a string operation. If Operand 1 is a number, it treats the number as a string, not a numeric value.
For example, if Operand 1 is 4085551212 and Operand 2 is 3, the value assigned to Result is 8.
Index is a string operation. If Operand 1 is a number, it treats the number as a string, not a numeric value.
For example, if Operand 1 is 5551212 and Operand 2 is 51, the value assigned to Result is 3.
Search String is a string operation. If either operand is a number, it treats the number as a string, not a numeric value.
Length is a string operation. If Operand 1 is a number, it treats the number as a string, not a numeric value.
AssignData can have one of the following results:
When using an ASCII editor, code this action with these parameters in the following order:
For example:
label: "Check Edges" AssignData(loc1_n, "ASSIGN", 5) edge EDGE_ASSIGN_OK: assign_ok edge EDGE_ASSIGN_OVERFLOW: assign_overflow edge EDGE_ASSIGN_MISMATCH: assign_mismatch edge EDGE_ASSIGN_NOT_OK: assign_not_ok ; AssignData(loc2_n, "ADD", loc1_n, 4); AssignData(loc3_s, "SUBTRACT", 10, loc2_n); AssignData(loc4_s, "MULTIPLY", loc3_s, loc2_n); AssignData(in1_n, "DIVIDE", loc4_s, 2); AssignData(in2_n, "MODULUS", in1_n, 13); AssignData(in3_s, "ABSOLUTE_VALUE", in2_n); AssignData(in4_s, "TRUNCATE", 12, 678); AssignData(loc1_n, "ROUND", in4_s, SV142); AssignData(loc4_s, "CONCATENATE", in4_s, in3_s); AssignData(loc4_s, "LEFT", in3_s, 4); AssignData(loc4_s, "RIGHT", loc3_s, 5); AssignData(loc4_s, "INDEX", loc4_s, 5); AssignData(loc4_s, "SEARCH_STRING", loc3_s, "hello"); AssignData(loc1_n, "LENGTH", loc3_s); AssignData(loc4_s, "TO_UPPERCASE", loc3_s); AssignData(loc4_s, "TO_LOWERCASE", loc4_s);
The parameters and edges are described above under "Parameters" and "Possible results". For more information, see Testing a state table using the debugger.
AssignData(SV541, "PUT_TAG", "ORIGIN", "1234");
SV541 has one tag: tag label ORIGIN with associated value 1234.
AssignData(SV541, "PUT_TAG", "RDIRN", "5678");
SV541 now contains 2 tags: ORIGIN (value 1234) and REDIRN (value 5678).
AssignData(SV541, "PUT_ATTRIBUTE", "RDIRN.CALL_REF", "90");
The tag identified by tag label RDIRN in SV541 now also has an associated
attribute CALL_REF which itself has an associated value of 90.
AssignData(SV541, "PUT_ATTRIBUTE", "RDIRN.PRESENT", "1");
Now REDIRN is associated to a second attribute PRESENT which has value 1.
AssignData(SV541,"CHANGE_TAG_VALUE", "REDIRN", "6789");
Tag identified by label REDIRN in SV541 has its value changed to 6789.
Now, using an initially empty local string: loc_s:
AssignData(loc_s, "REMOVE_TAG", SV541, "ORIGIN");
loc_s only contains tag RDIRN with its associated elements.
AssignData(SV541, "REMOVE_ATTRIBUTE", SV541, "RDIRN.CALL_REF");
SV541 still contains its original 2 tags, but the tag RDIRN now only has one
associated attribute left: PRESENT (value 1).
Now assume SV542 (incoming tag string from signalling process) contains 3 tags:
The first has label: CLGN, with value 1234 and attribute SCREEN with value 1.
The second has label: CALL_TYPE with value 1.
The third has label: FAC with value A7.
Consider the effects of the following steps, where local string variables
loc1_s and loc2_s are initially blank:
AssignData(loc1_s, "GET_TAG", SV542, "FAC");
loc1_s has one tag: its label name is FAC and value is A7. SV542 is unchanged.
AssignData(loc1_s, "GET_TAG", SV542, "CLGN");
loc1_s now has 2 tags: FAC (value A7) and CLGN with associated value 1234
and attribute SCREEN which has value 1.
AssignData(loc2_s, "GET_TAG_VALUE", SV542, "CLGN");
loc2_s contains the string: "1234".
AssignData(loc2_s, "GET_ATTRIBUTE_VALUE", SV542, "CLNG.SCREEN");
loc2_s is overwritten with the string: "1".