You can setup conditions for each rule. As default a blank condition is true, but you can configure InterformNG to decide if a blank condition is true or not. That is setup in the general system settings in the options, Ignore empty rules and No condition=false. They are described here General Systems Settings.
You can add a condition for the XML file selection (for the specific rule) by right clicking in the conditions column and select Add condition:
(The condition above checks the node in the input XML file: /Root/DocumentNo and only executes the rule, if the value in the node is equal to 1004).
The fields are:
Condition
You can combine conditions with either ‘AND’ or ‘OR’ for this. The first line for a rule should be blank.
Type
This is the type of condition you want to use. Possible values are:
XPATH
Use this to condition the rule on the contents of the XML file. Via the XPath language you extract information from the input XML file, which can be compared with a value.
DIR
Select the rule by comparing the directory where the XML file is found.
If you set the operator to EQUALS, then the full path must be specified e.g. like C:\XML_inbox\processing.If you state LIKE then you should specify a unique directory in the path - without any ‘\’ e.g. XML_inbox.
FILENAME
The file name of the XML file can be used for conditioning the rule.
METADATA
When calling InterFormNG either via the database plugin or via a socket call, you can set one or more metadata keys. With this you can condition the rule on these metadata keys.
Specification
If you select XPATH for the type above, then you should insert the Xpath expression here. For METADATA this should be the meta data key. For other types this should not be used.
Operator
Possible values are:
EQUALS
The expression selected in type (and specification) must be exactly what is specified in the Value field.
LIKE
Here you can use a compare text as the value using various special conditions for the comparison - se Value below.
CONTAINS
A part of the name should be equal to the value selected.
REGEX
The value is a regular expression.
Value
Here you can specify either a fixed string - if you are using ‘EQUALS’ as the Operator or a compare expression if you are using ‘LIKE’ or REGEX (regular expression).
Examples of regular expressions:
% |
Signifies any string which is has a length of 0 or more. |
\\ |
The backslash character |
[abc] |
a, b, or c (simple class) |
[^abc] |
Any character except a, b, or c (negation) |
[a-zA-Z] |
a through z or A through Z, inclusive (range) |
[a-d[m-p]] |
a through d, or m through p: [a-dm-p] (union) |
[a-z&&[def]] |
d, e, or f (intersection) |
[a-z&&[^bc]] |
a through z, except for b and c: [ad-z] (subtraction) |
[a-z&&[^m-p]] |
a through z, and not m through p: [a-lq-z](subtraction) |
. |
Any character (may or may not match line terminators) |
\d |
A digit: [0-9] |
\D |
A non-digit: [^0-9] |
\s |
A whitespace character: [ \t\n\x0B\f\r] |
\S |
A non-whitespace character: [^\s] |
\w |
A word character: [a-zA-Z_0-9] |
\W |
A non-word character: [^\w] |
Regular expressions are described here:
http://docs.oracle.com/javase/1.5.0/docs/api/java/util/regex/Pattern.html#sum