Variable: Edit
This module can be used to change values or keys in variable objects. The modifications to perform are defined in a b4A script, which is similar to the replacement rules defined for the |Automic| utility DB Change. A rule may replace a value if the whole or a part of the old value matches a given pattern.
Designation
- Name
- mc.VariableEdit
- Aliases
- VariableEdit
Configuration
- Optionen
- Test mode (
test-mode) - Activates a simulation mode
- b4A script variable (
command-vara) - A variable object containing commands to execute
- b4A script file (
command-file) - Name of a file containing the commands to execute
Description
The following b4A script commands are provided by the module:
-
replace_key( <regular expression>, <new value> )
Replaces the first match for the regular expression with the specified new value. This value may contain references to parts of the old value.
replace_key( "\(.*\)TEST\(.*\)", "$1PROD$2" ) -
replace_value( <regular expression>, <new value>[, <value column> ] )
Replaces a value with the new value if it exactly matches the old value. Using the optional value column parameter, the replacement can be limited to just one of the 5 values.
Replace the word TEST with PROD in all values.
replace_value( "TEST", "PROD" )The word TEST is replaced with PROD only in the second value.
replace_value( "TEST", "PROD", 2 ) -
replace_value_part( <regular expression>, <new value>[, <value column> ] )
This function works like replace_value, except that it searches for a regular expression and replaces it in the values.
replace_value_part( "\(.*\)TEST\(.*\)", "$1PROD$2" )
A description of the format of b4A script commands can be found here.