Initializing Variables in the Rules
If a variable is not set by a field and you’re going to compare its value to that of another variable to set a condition, you may want to set that variable to a starting or initial value. This is called “initialization”.
For example, assume we’re using a counter (%%OnePageDocs) to keep track of the number of one-page documents in an output. We want the counter set initially to 0 so we can increment it every time Enrichment encounters a one-page document. As the following figure shows, we set %%OnePageDocs to 0 in the START:
section of the rules and increment it in the DOCUMENT:
section. We set %%OnePageDocs to a new variable (%%Total1Pagers) in the FINISH:
section of the rules, perhaps to add this information to a report.
START:
%%OnePageDocs = 0
DOCUMENT:
IF %%TOTAL_PAGES = 1 THEN
%%OnePageDocs = %%OnePageDocs + 1
ENDIF
FINISH:
%%Total1Pagers = %%OnePageDocs