Managing Components in a Project

Overview of GLASS Studio Visual Builder Components

Once you have created a new project, or restored an existing GLASS Studio project, you are ready to start adding base pattern components to build out a GLASS custom data type.

Each component consists of a base pattern along with rules and/or parameters that define the expected pattern to match. See Building and Defining GLASS Patterns for more information.

You can add a new component to a project by:

Adding Your First Component

To add your first GLASS base pattern component after creating a new Visual Builder project from scratch:

  1. In the Visual Builder playground, add your first pattern to the project by selecting:

    • Start with RANGE - Add a RANGE component to search for N number of characters from a specific set of characters.
    • Start with WORD - Add a WORD component to match a specific word, phrase, or string of characters. or
    • Start with LIST - Add a GROUP component to search for any entry from an uploaded or manually added list of words, phrases or string of characters.

    Add first component in new GLASS Studio project

  2. Define the search pattern, options, and patterns rules for the selected RANGE, WORD, or LIST component.

Connecting a New Component

All base pattern components (e.g. WORD, GROUP, RANGE) in a GLASS Studio project must be connected to another component (or group of components).

Two or more components can be joined in:

  • Series with a THEN connector so that the data patterns and the corresponding rules defined by the connector must be matched consecutively, or
  • Parallel with an OR connector so that the data patterns and the corresponding rules defined by either of the connectors may be matched.

Both THEN and OR operators can be used together in a GLASS expression.

See THEN and OR Connectors for more information.

To connect a new base pattern component to an existing component:

  1. In the playground, go to the existing component which you want to join a new component to.
  2. To add a THEN connector, hover over and click on the + button at the top right corner of the existing component.
    Join two components in series using THEN operator
  3. To add an OR connector, hover over and click on the + button at the bottom left corner of the existing component.
    Join two components in parallel using OR operator

  4. In the base pattern form, select:
    • RANGE - Add a RANGE component to search for N number of characters from a specific set of characters.
    • WORD - Add a WORD component to match a specific word, phrase, or string of characters. or
    • LIST - Add a GROUP component to search for any entry from an uploaded or manually added list of words, phrases or string of characters.
  5. Define the search pattern, options, and patterns rules for the selected RANGE, WORD, or LIST component.

Duplicating a Component

You can create a copy of an existing component (or group of components) in the GLASS Studio Visual Builder playground. This allows reuse of components within a data type project which may share similar format with slightly different parameters. For example, with the exception of the serial number length, the format and rules for the serial number in ACME Corporation's regional and worldwide customer ID are similar.

To duplicate an existing component:

  1. In the playground, go to the existing component which you want to duplicate.
  2. Right click anywhere in the component to open the context menu and click on Copy.
    Right click and select Copy to duplicate a component or group of components
  3. Go to the component which you want to join the duplicated component to.
  4. Right click anywhere in the component to open the context menu and click on:
    • Paste > As Then to join connect the duplicated component in series.
    • Paste > As Or to join connect the duplicated component in parallel.

    Right click and select Paste to place duplicated a component or group of components

Grouping Components

You can use the grouping operator () to combine multiple GLASS expressions into a single logical expression, or to alter the precedence of GLASS operators. This enables you to develop GLASS expressions that will attempt to match more complex search patterns.

Operator Precedence GLASS Syntax
Grouping operator () 1 ( <expression 1> <THEN|OR> <expression 2> )
THEN Connector 2 <expression 1> THEN <expression 2>
OR Connector 3 <expression 1> OR <expression 2>

Grouping Components Example 1

Suppose you want to define a basic custom data type to search for ACME Corporation's regional customer ID using only the WORD and RANGE base patterns.

Basic expression to search for valid ccTLD values:

WORD 'AU' OR WORD 'IE' OR WORD 'KR'

Basic expression to search for valid 9-digit serial numbers:

MAP 'INVALID_SERIAL_NUM' 0
RANGE DIGIT TIMES 9 EXCLUDE 'INVALID_SERIAL_NUM'

Basic expression to search for the last check digit:

RANGE DIGIT

Let us consider joining the three basic expressions using RANGE without considering operator precedence.

MAP 'INVALID_SERIAL_NUM' 0
WORD 'AU' OR WORD 'IE' OR WORD 'KR' THEN RANGE DIGIT TIMES 9 EXCLUDE 'INVALID_SERIAL_NUM' THEN RANGE DIGIT

Since THEN has a higher operator precedence than OR, the resulting expression would instruct the GLASS engine to match data patterns that contain either:

  • AU, or
  • IE, or
  • KR, followed by 9 consecutive digits (000000001 to 999999999), followed by a single check digit (0 to 9.)

The grouping operator () can be used in the combined GLASS expression to change the order in which the expressions are evaluated to correctly search for regional customer ID numbers.

MAP 'INVALID_SERIAL_NUM' 0
(WORD 'AU' OR WORD 'IE' OR WORD 'KR') THEN RANGE DIGIT TIMES 9 EXCLUDE 'INVALID_SERIAL_NUM' THEN RANGE DIGIT

The resulting expression would instruct the GLASS engine to match data patterns that contain:

  • AU or IE or KR, followed by 9 consecutive digits (000000001 to 999999999), followed by a single check digit (0 to 9.)

See THEN Example 1 for more information.

Grouping Components in GLASS Studio Visual Builder Mode

To group two components together in GLASS Studio Visual Builder mode:

  1. In the playground, go to the first component which you want to include in a group.
  2. Left click and hold anywhere in the first component.
  3. Drag the first component to the THEN / OR + button of the second component to be included in the group.
  4. Release the first component once the THEN / OR bar is active.
    Left click, hold, drag and release to group components in GLASS Studio Visual Editor

Managing Component Groups in GLASS Studio Visual Builder Mode

As you build out a custom GLASS data type, it is likely that you will have multiple component groups. Similar to base patterns, you can copy a component group, delete a component group, add boundary rules, and more.

Connecting a New Component to a Component Group

See Connecting a New Component for more information.

Duplicating a Component Group

See Duplicating a Component for more information.

Naming a Component Group

In GLASS Studio Visual Builder mode, you can name a component group to more easily identify the various building blocks in your custom GLASS data type.

  1. In the playground, left click anywhere in the component group.
  2. In the group form, enter a descriptive name in the Group Name field.
    Naming Component Groups in GLASS Studio Visual Editor
  3. Click Close.

Adding Pattern Rules for a Component Group

Similar to the WORD, RANGE and LIST base pattern components, you can define pattern rules for a component group.

  1. In the playground, left click anywhere in the component group.
  2. In the Add Pattern Rules pane of the group form, select:
    Pattern Rules for Component Groups in GLASS Studio Visual Editor
    • Repeat Character/Octet (TIMES) to instruct the GLASS pattern matching engine to return the location as a match if the resulting search pattern for the component group appears N number of times.
      See Repeated Characters in a RANGE for more information.
    • Bound to define the content that the must be found before (BOUND LEFT), after (BOUND RIGHT), or surrounding (BOUND) the resulting search pattern for the component group for it to be a match.
      See BOUND Rule for more information.
    • Require (REQUIRE) to instruct the GLASS pattern matching engine to report a match only if the resulting search pattern for the component group is explicitly represented in the selected namespace(s).
      See REQUIRE Rule and MAP Namespace for more information.
    • Exclude (EXCLUDE) to instruct the GLASS pattern matching engine to exclude the resulting search pattern from being reported as a match if it is represented in the selected namespace(s).
      See EXCLUDE Rule and MAP Namespace for more information.
  3. Click Close.