PTC ALD in Arbortext Styler > Components of Documents and Templates > Creating New Content from the Main Content Stream > Running Headers > Evaluating Running Headers
  
Evaluating Running Headers
When using running headers, references set up the information to be used, and evaluation of the references provides the means to use that information.
The evaluation tool is provided as the formatting method formatting.evaluateRunningHeader(). This method returns a string so it can be used in other places which also take a string. The method takes a number of arguments, most of which are required:
Group — the running header group from which to obtain the running header reference
The value of this argument should be the same as the group number set in the reference. The allowed values are listed on the fRunningHeaderReference.RunningHeaderReferenceGroups constant, as for the fRunningHeaderReference.groups property.
Stream — the name of the content stream in which the reference is being set
Running headers can be extracted from any content stream — this parameter targets a specific content stream. The value should be a valid tag name or an fStream object.
The reference to process — whether to use only the first running header reference on the page, or the last, or to use the one from the previous page
Use the first and last values to create dictionary type running headers which show the first and last word found on that page.
Allowed values are listed on the fRunningHeaderReference.RunningHeaderText constant.
How to handle blank references — whether to leave the output blank if the running header reference is blank, or to use the previous reference
The allowed values are specified on the fRunningHeaderReference.RunningHeaderBlank constant.
Which is the first — which reference PTC Arbortext Layout Developer should consider the first on the page
The first reference can be either on the very first line of the page, or on any line.
Allowed values are listed on the fRunningHeaderReference.RunningHeaderFirstOnPageRef constant.
Maximum characters (optional) — instructs PTC Arbortext Layout Developer to limit the resolution of the running header evaluation to a specified number of characters
Use this parameter when you only want to show the first character, for example in bleed tabs.
This example code demonstrates the most common usage of evaluating running headers:
var text = formatting.evaluateRunningHeader(fRunningHeaderReference.GROUP_1, "tx1", fRunningHeaderReference.FIRST_ON_PAGE, fRunningHeaderReference.USE_PREVIOUS, fRunningHeaderReference.ON_ANY_LINE);

formatting.write(text);
Using this example, PTC Arbortext Layout Developer evaluates the group 1 running header from the text stream tx1. It takes the first on the page, but if that is blank it uses the previous reference. The first reference on the page can be on any line.