About arguments
Arguments enable you to pass values to a rule script. By using arguments, you can create generic rule scripts that can be applied to many situations and reduce the overall number of rules you need to write.
Arguments are substituted into a rule script when the rule runs in context. For example, in the following script, “Min” and “Max” are arguments that represent allowable range limits. If the value of the item represented by the “item” argument is not within the range, then the rule fails, and a query with the text in the “qtext” argument is generated:
Min = patient.getargument("min")
Max = patient.getargument("max")
qtext = patient.getargument("qtext")
addpath = patient.getargument("addpath")
item = patient.getcurpath() & addpath
Patient.AddNamedValue "QUERYTEXT", qtext
result.rulepassed = 1
v_val = patient.getvaluerf(item, "", 0,0,0)
If cDbl(v_val) < cDbl(Min) or cDbl(v_val) > cDbl(Max) then
result.rulepassed = 0
End If
When you create an argument definition as part of the process of defining a rule or a context, you specify the value to substitute. The value of an argument is one of its properties. The others are its name and type (date, float, numeric, or string).