User Tools

Site Tools


en:modify_variable_action

Modify Variable Action

Modify Variable Action is a useful action that can alter rule variable values. Actions that works after this action uses altered values.

Parameter NameDescription
Variable NameThe name of the variable we want to change
FindValue we want to change
ReplaceValue we want to use instead

Use Cases

Variable ValueFindReplaceResult
SambaPOS<empty>BestBest
SambaPOSSambaBestBestPOS
SambaPOSS(.*)SBestBest
SambaPOS<empty(S.*)POSSamba

On last two cases we used Regular Expressions.

  • When Regex used as Find value it replaces variable with replace value if Find value successfully matches.
  • When Regex used as Replace value it replaces variable with first regex group (the part in paranthesis) if regex matches.

Example

Suppose you are using NumberPad Value Entered rule to scan customer cards through magnetic card reader. Some card scanners sends mag card data between ; and ? characters. As you know we can read entered number with NumberpadValue parameter so before using NumberpadValue parameter you might want to trim these characters.

[;|%](.*)\? regular expression trims starting ; or % char and ending ? character. If we call this action before using NumberpadValue in Numberpad Value Entered rule we'll read trimmed value.

en/modify_variable_action.txt · Last modified: 2013/09/19 02:23 (external edit)