Entity Manipulations
Commands for Arguments
Arguments are very similar to variables, with only one difference - their values can not be changed in the process of digger's work. Arguments are initialized automatically when the iterator is running. So on each iterator cycle, the arguments takes values corresponding to this particular iteration. Like variables, arguments are often used for substituting values in queries, CSS selectors, and commands that support value substitution.
You can use the argument_get command to write a value of the argument to the register, argument_append and argument_prepend to add the argument value to the end or beginning of the register.
Examples of usage:
# SWITCHING TO THE BLOCK
- find:
path: .somepath
do:
# FILL THE REGISTER WITH THE VALUE OF `start_date` ARGUMENT
- argument_get: start_date
# PRESET VARIABLE `somevar`
- variable_set:
field: somevar
value: 123
# SWITCHING TO THE BLOCK
- find:
path: .somepath
do:
# FILL THE REGISTER WITH THE VALUE OF `age_123` ARGUMENT
- argument_get: age_<%somevar%>
# SWITCHING TO THE BLOCK
- find:
path: .somepath
do:
# SET `date` STRING AS VALUE OF THE REGISTER
- register_set: date
# ADD VALUE OF `start_date` ARGUMENT TO THE END OF THE REGISTER,
# USING ": " FOR JOINING VALUES
- argument_append:
field: start_date
joinby: ": "
# REGISTER VALUE: date: 2017-10-07
# ADD VALUE OF `start_date` ARGUMENT TO BE BEGINNING OF THE REGISTER,
# USING "" FOR JOINING VALUES
- argument_prepend:
field: start_date
joinby: ""
# REGISTER VALUE: 2017-10-07date: 2017-10-07
Next we will learn about static variables.