DashCode

Use this function to build a value to assign to a series of fields from the binary value of an integer. This is sometimes called a dash code. A dash code is a type of OMR mark that is read by certain mail, binding, or inserting equipment.

A dash code is a series of horizontal lines aligned in a column — each usually around 1/2 to one inch in length — that are typically on the left or right edge of the paper. The marks are usually expected to be in a uniform (fixed) position. Here is an example of a dash code:

Dash code

Dash codes can be used, for instance, to represent the beginning or end of a set of pages that are associated in some way. The marks might indicate sequencing, first page, last page, staple requirements, additional pages to be inserted at a given point, the envelope size, or binding requirements.

Note The exact meaning, order, and position of each mark depends on the finishing equipment you are using. Check the specifications that came with your equipment and assign the values appropriately.

Syntax

DashCode(Value, Bits, RootName, Section, Form, Group, OnString, OffString, Direction, AltLens)

Parameter

Description

Value

Each bit of the value parameter is tested for a one (1) or zero (0). If the bit is one (1), it is considered on and the character you specify in the OnString parameter is appended to the string result being built. If the bit is zero (0), the OffString parameter is appended to the string result.

Bits

This parameter identifies how many of the bits from the value need to be evaluated. By default all 32 bits are evaluated. If you specify a negative or zero value, you’ll get an empty string.

RootName

This parameter identifies the initial portion of a series of field names that are to be the repository for the OnString and OffString filled values. The bit number referenced will be appended to each name to form the final name expected to be found on the resulting section.

For instance, if MVALUE_ is passed as the RootName, the first fill value is assigned to MVALUE_1, the second to MVALUE_2, MVALUE_3, and so on, until the maximum number of bits specified are all mapped. If all 32 bits are mapped, the last field would be MVALUE_32.

The associated fields will be filled to their defined length. In most dash code (bar code) type situations, you will want all the fields to be the same length.

Section

Enter the name of a section that contains the field you specified. You can enter an asterisk (*) to tell the function to search all sections. Keep in mind, however, that including an asterisk (*) degrades performance.

Form

Enter the name of a form that contains the section and/or field you specified. You can enter an asterisk (*) to tell the function to search all forms. Keep in mind, however, that including an asterisk (*) degrades performance.

Group

Enter the name of the form group that contains the form, section, or field. You can enter an asterisk (*) to tell the function to search all groups. Keep in mind, however, that including an asterisk (*) degrades performance.

OnString

By default, OnString is an underscore (_). You can specify alternative OnString and OffString values and each can be more than one character. The two parameters do not have to be the same length.

If you define multiple characters, the fill value will repeat those characters as necessary to fill the entire field. If the field length is not evenly divisible by the length of the string you enter, a partial copy of the string can appear at the end.

For instance, suppose the field length is five; OnString is ABC; and OffString is XY. If the bit value for this field is one (1), the fill value generated will be: ABCAB. If the bit value is zero (0), the fill value generated for this field will be XYXYX.

OffString

By default, Offstring is a space ( ). You can specify alternative OnString and OffString values and each can be more than one character. The two parameters do not have to be the same length.

If you define multiple characters, the fill value will repeat those characters as necessary to fill the entire field. If the field length is not evenly divisible by the length of the string you enter, a partial copy of the string can appear at the end.

Direction

Note that integer values have 32 bits. When looking at the value in binary form, bit 1 is on the right and bit 32 is on the left. To override the default behavior, you can supply a non-zero Direction parameter.

0000 0000 0000 0000 0000 0000 0000 0000

Bit 32 | | Bit 1

AltLens

The final parameter is a comma-delimited pattern string to identify alternate lengths for each field associated with the bits. By default, each field is assigned a value equal to its defined length. If you want to use a different length, supply the appropriate lengths in string form separated by commas.

The order of the length values starts with the field associated with the first bit, followed by the length for the second field, and so on. Remember the first bit is determined by the direction parameter. If you do not provide enough length values to match the number of bits you are using, the undefined positions will default to the default field length.

The return value indicates the number of fields assigned. A return value of zero (0) means that no fields were found.

Example

Here are some examples:

#val = 11 (which is 1011 in binary)

DASHCODE(#val, 4, "BFLD");

Assuming that BFLD is a root field name and matching fields are located on the current section, the following assignments are made. Further assume that each field is five characters in length.

BFLD1 is assigned "_____"
BFLD2 is assigned "_____"
BFLD3 is assigned " " (five spaces)
BFLD4 is assigned "_____"

DASHCODE(#val, 4, "BFLD", , , , "A", "B");

This example uses the parameters to supply different OnString and OffString parameters.

BFLD1 is assigned "AAAA"
BFLD2 is assigned "AAAA"
BFLD3 is assigned "BBBB"
BFLD4 is assigned "AAAA"

DASHCODE(#val, 4, "BFLD", , , , "A","B",1);

Note the Direction parameter was used to reverse the order of the bits interpretation.

BFLD1 is assigned "AAAA"
BFLD2 is assigned "BBBB"
BFLD3 is assigned "AAAA"
BFLD4 is assigned "AAAA"

DASHCODE(#val, 4, "AB", "XYZ", 0, "1,2,3,5");

In this example, the last parameter applies differing lengths to the fields you are mapping. This example also uses alternate OnString and OffString parameters and uses text greater than one character. In this case, the string may be truncated or repeated as necessary to fill the field length.

BFLD1 is assigned "A"
BFLD2 is assigned "AB"
BFLD3 is assigned "XYZ"
BFLD4 is assigned "ABAB" or "ABABA"

Note that the last example indicates two possible results. During Documaker Desktop entry, the field length is considered paramount and cannot be overridden. During batch operations, it is possible for the data length to override the field length.

See also