Home - Media - Downloads - Manual - Bug Reports/Feedback - Donations  

Filters

Anatomy of a filter

A filter is a combination of

When a a filter is applied, its expression is evaluated against an unit. The expression may refer to one or more properties of the unit. If the expression matches the properties of the unit, an operation will be executed. Depending on the context, the operation may be to select the unit or to rename it by applying the appropriate template from the filter.

There are no 'sanity checks' on the filter conditions, so it's entirely possible to create an expression that will never or always match.

Filter expressions

Example of a filter expression:

form(div) & size(1,5) & min(LARM,1) & none(ARM)

This expression would match any unit that:

Another example:

form(div) & (min(INF,2) | min(MOT,2) | min(INF,1) & min(MOT,1))

This expression would match any unit that:

This expression could also be written as:

form(div) & min(INF,MOT,2)

List of available conditions

Condition Meaning
form(f) Formation is f
size(n) Unit consists of exactly n elements.
size(m,n) Unit consists of m to n elements. n is ignored if it is 0.
min(t,n) Unit consists of at least n elements of the given type(s).
max(t,n) Unit consists of at most n elements of the given type(s).
one(t) Unit contains exactly one element of the given types(s).
none(t) Unit contains no elements of the given type(s).
only(t) Unit contains only elements of the given type(s).
more(x,y) Unit contains more elements of type x than y (1).
moreeq(x,y) Unit contains more or an equal number of elements of type x than/as y.
most(t) Most of the elements of the unit are of the given type(s).
mosteq(t) Most or an equal number of elements of the unit are of the given type.
least(t) Least of the elements of the unit are of the given type(s).
leasteq(t) Least or the an equal number of elements of the unit are of the given type(s).

Where:

Higher level filters

For all but the form condition there exist an equivalent conditions that do not target elements but units. These conditions can be used in higher level filters, i. e. they match to HQs which have the required subordinate units assigned. The conditions that match to units always ends on an 'f', e.g. sizef, maxf, onlyf.

List of available operators

Expressions can also contain operators for joining the conditions together:

Operator Meaning
& Boolean "AND"
| Boolean "OR"
! Boolean "NOT"
() Evaluation of expressions inside parentheses takes precedence

Filter sets

A filter set is simply a collection of filters. The ART evaluates the filters in the order in which they appear in the filter set. If a filter is a match, no other filters will be evaluated against the given unit. This means that if you have two filters, a more general one and a more specialized one, you must place the more specialized filter above the general one. Otherwise, the general filter will always match before the specialized filter is evaluated which that the latter would never be applied.

Similarily, higher level filters need to be placed after any lower level filters. This is necessary, because the lower level filters are used to classify units and assign the respective unique ID to them. The higher level filters can then refer to the unique IDs.

Filter templates

If you select an unit and use the Auto rename action, the ART will look for a matching filter in the loaded filter set. If it finds one for which an applicable template has been defined, ART will rename the unit according to this template. A template is an arbitrary string and can contain placeholders. It must not have more than one generator placeholder. The generator placeholder is processed only after all reference placeholders have been resolved. The number of reference placeholders is unlimited. All placeholders start and end with the percent character (%).

Smart generator placeholders

The smart generator placeholders are: Don't forget to enclose the placeholders in percent characters (e.g. %a%)!

E.g. "%o% Corps" would be expanded to "4th Corps".

When using smart generator placeholders, ART will (re)number units starting from the first numeral (1/1st/A/I). It will skip unit names that already exist and try to fill any gaps in the enumeration.

Example

A hypotetical OOB consists of the following units:

Let us assume that the divisions match a filter with the template "%a%. Inf Division" and the corps a filter with the template "%o% Corps". If you use the auto renaming tool on all units, you will get the following results:

Reference Placeholders

Reference placeholders are replaced with certain properties of the unit being renamed, its superior HQ or its theatre HQ. All reference placeholders are resolved before any generator placeholder is evaluated.

The reference placeholders are:

Placeholder Replacement
ta The complete name of the parent theatre
tex Any part of the parent theatre's name enclosed by x. x is optional and denotes the character enclosing the nickname (default: " ).
twx The word at the position indicated by x in the parent theatre's name (x: single digit)",
tcx?y:z If the parent theatre's name contains x, replace with y else with z (x,y,z: strings)
sa, sex, swx, scx?y:z As above, but reference the parent HQ's name instead.
f The formation type of the unit
p The name of the province in which the unit currently resides.
hx Preserve the unit's nickname and re-insert it at the position of this placeholder. x is optional and denotes the character enclosing the nickname. Defaults to single quote (') if not given.

The placeholders referencing the parent unit's or parent theatre's name also accept an extra option to keep any trailing periods from the referenced string. For this, insert "!," directly before the closing '%'.

Examples

With multi-country templates, you only need to define a filter once while still be able to assign country-specific unit names when using the auto renaming actions. This also comes in handy if the OOB contains expeditionary units.

OOB (current names): HQ 'East' + 1st Reserve Corps + Infantry Division
Template applied to the division: %a. Inf Division %s2 %t'
Result: 1. Inf Division Reserve East

OOB (current names): HQ East + 2. Corps + Infantry Division
Template applied to the division: %s1%a. Inf Division %t2
Result: 2.1. Inf Division East

OOB: 1 army + 1 corps + 2 divisions
Template applied to all: %o %f
Result: 1st Army, 1st Corps, 1st Division, 2nd Division

Some unit's names may include nicknames e.g. "37th 'Buckeye' NG Division". The $h'% placeholder aims at preserving these nicknames by (re-)inserting them at the position of the placeholder after the other renaming steps are finished.

Let's say our filter expression matches INF divisions and is associated with the template:

$o%. Inf. Div. %h'$

The single quote ' tells ART which character to expect around nicknames. The placeholder marks the position where the nickname should be (re-)inserted.

Our OOB contains a few INF divisions:

1. Infanterie
'Brandenburger' Division
9. Infanterie Regiment

Applying the template above yields:

1. Inf. Div.
2. Inf. Div. 'Brandenburg'
3. Inf. Div. 'Vorwaerts'
4. Inf. Div.

Multi-country templates

Each template is associated with a country. Multiple templates, each for a different country, can be assigned to the same filter. For example, [GER] tells ART to use the template when renaming german units. If no country specific template is found, the template tagged with [***] will be used. If neither a matching country specific template nor a generic template can be found, the filter has no effect when renaming units.

Higher level filters

It is also possible to create filter expression that match for HQs based on the subordinate units assigned to them. To this end, all filters include an unique ID. When a filter matches an unit, the unit gets tagged with this ID. Another filter can then reference this ID in its expression.

Let's assume we want to rename panzer divisions, corps and armies. We will first need a filter for panzer divisions:

form(div) & min(ARM,1)

We give this filter the ID 'armdiv'. We can then write the expression for a panzercorps:

form(cps) & minf(armdiv,2)

A panzercorps is a corps with at least two panzer divisions (as defined by the 'armdiv' filter). Note that we use 'minf' here (as opposed to to 'min' that would check against elements).

Now let's give this filter the ID 'armcps' and continue on to the next level:

form(army) & minf(armcps,2)

A panzer army is an army with at least two panzer corps (as defined by the 'armcps' filter).

With a suitable filter set in place, this mechanism will let you automatically rename your whole OOB with minimal effort.