Repeating Characteristics

DataSmith looks for a characteristic once per section. Sometimes it is necessary to locate a characteristic more than once per section. Repeating Characteristics are characteristics which repeat an unknown number of times per section. PC-DMIS files will commonly contain repeating characteristics. An example of repeating characteristics within a PC-DMIS file is shown below.

Setting up your DataSmith (.4datasmith) file to locate repeating characteristics involves using the Search > rep instruction and checking Allow Repeat Characteristics in the Feature Properties dialog and checking Repeatable in the Characteristic Properties dialog.

The example of repeating characteristics contains both repeating feature and repeating sample data.

·        The feature is shown in the light yellow colored cross hatch

·        The Feature Label is highlighted in green

·        The Sample Label is highlighted in light magenta

The Sample Label occurs once per line, but it also occurs five times within the feature. The feature is considered a section by DataSmith. The Date, Time and Deviation Characteristics also occur multiple times within the feature. The Deviation Characteristic, highlighted in purple, uses the ~ord~ and ~rep~ instructions. For the purposes of this example, you will learn how to highlight the repeating characteristic Sample Label.

Create a Repeating Characteristic

Repeating characteristics are usually set up by first highlighting the characteristic to be repeated, then setting up the characteristic to repeat. We will locate the first instance of the Sample Label and highlight it, then change the settings of the Sample Label characteristic and the Feature to make it repeat.

1.     A new characteristic is created, named Sample Label. The color light magenta has been chosen to represent the Sample Label.

2.     The Sample Label characteristic is located by counting the tabs before the first instance. The instruction "Locate the next character that is a tab 5 times." will place the cursor just before the fifth tab.

3.     The cursor now needs to moved to a location where it will be able to highlight the sample label. The instruction "Locate the next character that is a label." will position the cursor just before the first character of the label, 2.

4.     Now, the first instance of the sample label needs to be highlighted. The instruction "Mark the label at current position." will highlight the label 2211 in the color light magenta.

5.     An additional instruction needs to be added, telling DataSmith to find the rest of the sample labels.

a.     Inserting "Move to the next line ~rep~ times." before the other instructions will make DataSmith search through each line consecutively.

b.     The ~rep~ instruction keeps track of which lines it has already scanned and will continue to scan until it fails to find another sample label. For more information about ~rep~ see the topic Instruction Definitions.

6.     The instructions that were used to highlight the Sample Label are shown below.

7.     The ~rep~ instruction alone will not make DataSmith look for repeating characteristics. You must check the Repeatable box in the Characteristic Properties dialog and the Allow Repeat Characteristics box in the Feature Properties dialog.

8.     The resulting scan of the data file will produce features that have been given unique identifiers (PT1, PT2, PT3 & PT4), and the characteristic data can then be located.