Operations let you modify variables in ways that were previously only available through the use of advanced metadata. See the table below of the transformations available in the Set Variable behavior.
|Add||Operand: Integer||Add the value of an operand to the variable. The transformation could fail if either of the input values are not integers.|
|Base 64 Encode||Apply base64 encoding to a variable.|
|Base 64 Decode||Decode a base64-encoded string.|
|Base 32 Encode||Apply base32 encoding to a variable.|
|Base 32 Decode||Decode a base32-encoded string.|
|Bitwise AND||Operand||Perform a bitwise-and operation on the variable and an operand. This transformation could generate an error if either of the inputs is not an integer.|
|Bitwise NOT*||Perform a bitwise-not operation on the variable. This transformation could generate an error if the input is not an integer|
|Bitwise OR||Operand||Perform a bitwise-or operation on the variable and an operand. This transformation could generate an error if either of the inputs is not an integer.|
|Bitwise-XOR||Operand||Perform a bitwise-xor operation on the variable and an operand. This transformation could generate an error if either of the inputs is not an integer.|
|Decimal To Hex||Convert a decimal integer to a hexadecimal string. This transformation could generate an error if the input is not an integer.|
|Decrypt||Algorithm: Picklist Encryption Key: String Initialization Vector: String Encryption Mode: Picklist Nonce: String Prepend Bytes: On/Off||Decrypt an encrypted string.
|Divide||Operand||Divide the variable by the value of an operand. This transformation could generate an error if either of the inputs is not an integer or if the value of the operand is zero (0).|
|Encrypt||Algorithm: Picklist Encryption Key: String Initialization Vector: String Encryption Mode: Picklist Nonce: String Prepend Bytes: On/Off||Encrypt the variable. The output is the nonce followed by the base-64 encoded encrypted input.
|Epoch to String||Format String||Transform a value taken to be in epoch time,
|Extract Parameter||Parameter Name: String Separator: Character Case Sensitive: On/Off||Extract a value from a list of parameters.
A use case for this is to extract query parameters without having to write a regular expression, but it can be used to look up values in any name/value pair list.
If several occurrences of the parameter exist, only the first one is returned. If the parameter is not found, the transformation fails and the variable gets a blank value. The separator between the name and the value of a parameter is always '=', but the parameter separator can be specified.
Example: Value (lookup table) =
|Hash||Min: Integer Max: Integer||Hash the input string into an integer. This returns the string representation of
|Hex to Decimal||Convert a hexadecimal string to a decimal integer.|
|JSON extract||Operand||Extract JSON data from the variable using the JSONPath expression you formed in an operand.|
|Hex Decode||Decode a hex-encoded string.|
|Hex Encode||Encode input as hex-encoded string.|
|HMAC||HMAC Key: String HMAC Algorithm: Picklist||Produce a base64 encoded digest value from the variable value and key.|
|Lower Case||Convert the string to lower case.|
|MD5 Hash||Obtain the MD5 of the value provided in one of the attribute tags ( or ) or of the value of the
|Minus||Transform the value into a negative value.|
|Modulo||Operand||Return the remainder of division of the value with an operand. This transformation can fail if either of the input values is not an integer or if operand is zero (0).|
|Multiply||Operand||Multiply the value of an operand with the variable. The transformation could fail if either of the input values are not integers.|
|Normalize Path Windows||Remove multiple slashes, self-references, and directory back-references.|
|Remove Whitespaces||Remove all whitespace characters.|
|Compress Whitespace||Convert whitespace characters to spaces, then compress multiple space characters into only one.|
|SHA1||Calculate an SHA1 hash from the value.
|SHA256||Calculate an SHA256 hash from the value.
|String Index||Substring: String||Returns the position of the first occurrence of a substring inside the input string, or -1 if it is not found. This comparison is case sensitive. This operation never fails, it simply returns -1 when the substring is not found.|
|String Length||Returns the string length of the input variable.|
|String to Epoch||Format String: String||Convert a string value from strptime format, or a custom defined format, into epoch time. You can specify the format of the string-to-epoch transformation. If no value is specified, or the if is set to RFC2616, the format of the input string is interpreted as RFC2616 format. You can specify a custom format using strftime variables. See the strftime(3) man page for proper format variables:
|Substitute||Regex: String Replacement: String Case Sensitive: On/Off Global Substitution: On/Off||Perform a regular expression-based substitution (similar to Perl's =~ s/regex/replacement/flags). Specify the regex, replacement string and global+case-sensitive options.|
|Substring||Start Index: Integer End Index: Integer||Extracts a substring from the input variable/value. The start index is the position of the first character of the desired substring (0 for first character, 1 for second character, etc.). Negative values are relative to the right side of the input string. The end index is the position of the character after the end of the desired substring. -1 represents the last character of the string.
Consider this example for a string of
Start Index = 0 , End Index = 1, Result =
Start Index = 0 , End Index = 2, Result =
Start Index = 1 , End Index = 1, Result =
Start Index = 1 , End Index = 2, Result =
Start Index = 3 , End Index = -1, Result =
Start Index = -2, End Index = -1, Result=
|Subtract||Operand||Subtract the value of an operand from the variable. The operation could fail if either of the input values are not integers.|
|Trim||Removes leading and trailing white spaces from the input.|
|Upper Case||Convert the input to upper case characters.|
|Base 64 URL Decode||The same as Base 64 Decode, except before decoding replaces |
|Base 64 URL Encode||The same as Base 64 Encode, except after encoding this removes trailing |
|URL Decode||URL decode the variable. All sequences of '%' followed by 2 hexadecimal characters are replaced with the corresponding ASCII value. The sequence '%%' is replaced with '%'. The sequence '%00' causes the transformation to fail, since the value of a variable is a null-terminated string and therefore cannot contain any null characters.
|URL Encode||Except Chars: String Force Chars: String||URL encode the variable. All characters deemed unsafe or reserved by RFC 1738 are escaped. That is, they are replaced with '%' followed by their 2-character hexadecimal value.
Unsafe characters are:
ASCII characters between
|URL Decode Unicode||URL decode the variable value, including unicode encoding. All sequences of '%' followed by 2 hexadecimal characters are replaced with the corresponding ASCII value. The sequence '%%' is replaced with '%'. The sequence '%00' causes the transformation to fail, since the value of a variable is a null-terminated string and therefore cannot contain any null characters.
|UTC Seconds||Convert a string in ISO 8601 time format to UTC seconds.|
|XML Decode||XML-decode the variable value. This operates in the reverse of XML Encode. Invalid entities cause the operation to fail.|
|XML Encode||XML-encode the variable value. Characters |
To use more than one transformation on a variable, use multiple Set Variable behaviors in the rule. The order matters when setting the different transformations, and the transformations are applied in the order they appear in the rule. After the first transformation, any subsequent instance of the Set Variable behavior must have that variable selected as were the value is coming from. You can string as many transformations together as you want.
Set Variable only allows one transformation per instance of the behavior. If you require multiple transformations for a variable, use multiple Set Variable behaviors.
For example, if you want to retrieve the first two characters of a variable's value, then change those two characters to uppercase. To do this you would need two instances of the Set Variable behavior; one to change the case of the value, and the other to retrieve the first two characters from that same value.
This is how you would accomplish this task:
Add the first instance of Set Variable.
Select the variable you want to transform.
Select Extract as the source of the value.
Select Request Header.
Enter the name of the header to take the value from.
Select Upper Case transform.
Add a second Set Variable behavior.
Select the same variable.
Create value from expression.
Add the variable as the expression value.
Select sub-string as your transformation.
Start index of 0.
Max index of 1.
Updated about 2 months ago