@Abstract (JavaScript)

Abbreviates the content of fields.

Defined in

@Functions (JavaScript)

Syntax

@Abstract(keywords:string, size:int, beginText:string, bodyFields:string) : string
Parameter Description
keywords Directives for creating the abstract. Specify multiple keywords in an array. See the usage section for a description of the keywords.
size Maximum number of characters in abstract. Excessive content is truncated. A specification of 0, null, or an empty string means no characters.
beginText Text to put at the beginning of the abstract. A specification of an empty string means no beginning text.
bodyFields The XPath of the data associated with a field. Specify multiple fields in an array.
Return value Description
string The abstract.

Usage

Initially the abstract is the content of bodyFields. Keywords are applied to the abstract in sequence. The keywords are as follows. The keywords must be exact, including brackets, except for case.
Keyword Description
[TRYFIT] Attempts to fit the abstract (at the current point of processing) into the number of characters allowed by size. If the abstract fits, processing stops and the abstract as it stands is returned.
[ABBREV] Applies preceding [DROPVOWELS], [DROPFIRSTVOWEL], [TRIMPUNCT], and [TRIMWHITE] keywords to the abstract.
[DROPVOWELS] Drops all vowels from the abstract, except vowels that start words unless [DROPFIRSTVOWEL] is also present. Applied at the next [ABBREV] keyword.
[DROPFIRSTVOWEL] Drops vowels that start words from the abstract. Requires specification of [DROPVOWELS]. Applied at the next [ABBREV] keyword.
[TRIMPUNCT] Removes all white space around punctuation. Applied at the next [ABBREV] keyword.
[TRIMWHITE] Removes extraneous white space. Applied at the next [ABBREV] keyword.
[RULE1] Generates the following keywords: [TRYFIT], [TRIMPUNCT], [TRIMWHITE], [ABBREV], [TRYFIT], [DROPVOWELS], [ABBREV].
[RULE2] Generates the following keywords: [TRYFIT], [TRIMPUNCT], [TRIMWHITE], [ABBREV].
[RULE3] Same as [RULE1].

Examples

The following examples are the value formulas for computed fields. They act upon two fields bound to the data elements field4 (string) and field5 (integer) whose concatenated value is as follows:
given current inputs, the total   is   99

This example applies [RULE2] in a situation where the input content fits.

var fields = @List("//field4", "//field5");
@Abstract("[RULE2]", 64, "Total: ", fields);

The result is as follows. Essentially the abstract is the same as the input.

Total: given current inputs, the total   is   99

This example applies [RULE1] in a situation where it is necessary to trim and drop vowels.

var fields = @List("//field4", "//field5");
@Abstract("[RULE1]", 32, "Total: ", fields);

The result is as follows:

RULE1 Ttl:gvn crrnt inpts,th ttl is 99

This example drops vowels, drops first vowels, and trims. It has no beginning text.

var keywords = @List("[DROPVOWELS]", "[DROPFIRSTVOWEL]",
	"[TRIMWHITE]",  "[TRIMPUNCT]", "[ABBREV]");
var fields = @List("//field4", "//field5");
@Abstract(keywords, 64, "", fields);

The result is as follows:

gvn crrnt npts,th ttl s 99