Create results for a group field Script Locator

In the following example, an Advanced Zone Locator is configured to extract a full name such as “Bruce Matthews”. The Script Locator retrieves this result and splits the name into a subfield for the first name and a subfield for the last name, for example, Bruce Matthews.


Example script routine

You can create results for a group field by following these steps:

  1. Create one or more alternatives as follows:
    pLocator.Alternatives.Create
  2. Create subfields for each alternative.
    pLocator.Alternatives(<N>).Subfields.Create(<Subfield Name>)
    Note Make the subfield names match those defined on the Field Definition tab.
  3. In combination with additional logic, use the results from other locators to create the required values within the Script Locator. Retrieve results from other locators as follows:
    pXDoc.Locators.ItemByName(<Locator Name>).Alternatives(<N>).Text

    This example retrieves the alternative with index N from a locator producing multiple single-result alternatives, such as a Format Locator.

    pXDoc.Locators.ItemByName(<Locator Name>).Alternatives(<N>).Subfields.ItemByName(<Subfield Name>).Text

    This example retrieves a subfield result from a locator producing multiple subfields per alternative, such as an Advanced Zone Locator.

  4. Assign text values to the Script Locator subfields.
    pLocator.Alternatives(<N>).Subfields.ItemByName(<Subfield Name>).Text = <TextValue>
  5. Assign confidence values (between 0 and 1) to the Script Locator subfields.
    pLocator.Alternatives(<N>).Subfields.ItemByName(<Subfield Name>).Confidence = <ConfidenceValue>
  6. If required, assign co-ordinate values (in pixels) to the alternatives in the Script Locator subfields.
    pLocator.Alternatives(<N>).Subfields.ItemByName(<Subfield Name>).Top = <Top Coordinate>
    pLocator.Alternatives(<N>).Subfields.ItemByName(<Subfield Name>).Left = <Left Coordinate>
    pLocator.Alternatives(<N>).Subfields.ItemByName(<Subfield Name>).Height = <Height>
    pLocator.Alternatives(<N>).Subfields.ItemByName(<Subfield Name>).Width = <Width>