If you’ve ever looked under the hood of Oracle Documaker Enterprise Edition (ODEE) and wondered how the heck batching rules actually work, you’re not alone. It’s one of those “power user” features that’s both powerful and…quirky. Most folks know by now that batching rules use FreeMarker syntax for data substitution. But if you’ve dug into the reference implementation, you’ve probably noticed some odd-looking expressions like this:

(${RCPS.ADR_SELECTED}&32)==32

Wait—what? Let’s break it down.

Two Expression Engines: FreeMarker + JEXL

Here’s the trick: starting with ODEE 12.5, batching rules are evaluated using both:

  • FreeMarker (for data substitution)

  • JEXL (Java Expression Language, for evaluating the resulting logic)

First, FreeMarker replaces ${RCPS.ADR_SELECTED} with the actual value from the data. Then JEXL evaluates the expression using that substituted value.

So for example, let’s say our transaction has a recipient batch that references a recipient record with:

RCPS.ADR_SELECTED = 32

Then this expression:

(${RCPS.ADR_SELECTED}&32)==32

Becomes:

(32 & 32) == 32

In JEXL, the & operator is a bitwise AND—a concept you might remember from your old CS classes. It compares each bit of two numbers. If both bits are 1, the result is 1. Otherwise, it’s 0.

Here’s the bit math:

32 (decimal)   = 0010 0000
32 (decimal)   = 0010 0000
-------------------------
Bitwise AND    = 0010 0000 = 32 (decimal)

Since (32 & 32) == 32, this expression evaluates to true—and the record is selected into the batch. I know, I know, you're probably still wondering why use the bitwise operator?

Why Bitwise Logic?

This setup lets you encode multiple flags into a single numeric field. So, instead of writing a big ugly  IN (…) clause, you can toggle values like bits in a flag register – and this is especially useful in batching rules where a recipient batch could be routed to multiple batches. For example:

Channel

Bit Value

Email

4

SMS

16

Fax

32

Let’s say you want to send a recipient batch via both Email and Fax. Just store 36 in RCPS.ADR_SELECTED, because:

36 = 32 (Fax) + 4 (Email)

Then:

(36 & 32) == 32 → true   (Fax is selected)
(36 & 4)  == 4  → true   (Email is selected)

Nice and compact!

Where This Came From

This change first appeared in version 12.5. If you go digging through the ODEE Administration Guide, you’ll find it oddly buried in the Upgrade section (page 483, to be exact). Ideally, it should be in the core documentation—but hey, at least it’s somewhere.

Here’s the excerpt:

Starting in Release 12.5, the setup for batching rules changed. Instead of using raw SQL WHERE clauses, batching rules now use a combination of FreeMarker and JEXL expressions. The Select Criteria Rule uses a whitelist of allowed schema column variables in FreeMarker format (e.g., ${TRNS.TRN_ID}), and evaluates them using JEXL. This approach reduces database queries (they’re only run once per batch instead of per transaction), which can improve performance.

More Examples

Example 1 – Local Print Routing:

(${RCPS.ADR_SELECTED}&2)==2

If ADR_SELECTED = 2, this evaluates to (2&2)==2, which is true.

Example 2 – String Comparison:

'${RCPS.RCPCUSSTR001?upper_case}' eq 'AUTO'

This expression:

  • Converts the value of RCPS.RCPCUSSTR001 to uppercase

  • Compares it (as a string) to 'AUTO'

💡 Tips for string expressions:

  • Enclose both sides of the expression in single quotes

  • Use FreeMarker functions like ?upper_case to normalize your data before comparison

Migration Tool

Good news: 12.5 onwards includes a conversion utility to help migrate your old SQL-style batch rules to the new FreeMarker/JEXL syntax. You’ll find it here:

[ODEE_HOME]/documaker/docfactory/bin/update-batchings.sh|bat

The tool will convert your old batchings to the new format and retains the originals as inactive backups.

  •  

 

TL;DR

  • FreeMarker fills in data values.

  • JEXL evaluates the resulting logic.

  • You can use bitwise logic to create compact, efficient rules.

  • This system was introduced in ODEE 12.5.

  • There’s a migration tool to help you convert older rules.

 

Got questions about batching, bitmasks, or anything else Documaker-related? Leave a comment, drop me a line, or post over on the forum!

Andy
 

Additional Resources