Additional Snippet Framework Features

The Snippet Framework also has other features that will help you to define your Dynamic Applications.

Substitution

Substitution occurs during the Argument Parsing step, prior to converting the snippet argument into the appropriate steps for the framework to execute. Substitution occurs for the following values, indicated within the < and > characters.

<silo:app_id>

The application ID of the Dynamic Application

<silo:gmtime>

The timestamp for the data when saving to the database for the Dynamic Application

<silo:freq>

The poll frequency of the Dynamic Application

<silo:comp_name>

The name of this component device

<silo:comp_dn>

The Unique identifier for the DCM tree of this component device

<silo:comp_uid>

The Unique ID of this component device

<silo:did>

The Device ID (DID) of this device/component device

<silo:root_did>

The root Device ID of this component device

<silo:parent_did>

The parent Device ID of this component device

<silo:guid>

The Globally Unique Identifier (GUID) of this component device

<silo:ip>

The IP address of this component device

Substitution Usage

The way to use the substitution values is as follows:

../_images/snippet_arg_substitution.png

Custom Substitution

You can also write your custom substitution in the snippet code. An empty dictionary, called custom_substitution, lets you build your own custom substitutions.

The example below shows you how to do custom substitutions:

../_images/custom_substitution.png

Substitution Example

Suppose we have a device with a Unique Identifier equal to /api/account/1 and a custom substitution as in the avobe image. The substitution in the snippet argument will be as follows.

Before substitution

After substitution

low_code:
  version: 2.0
  id: FirstName
  steps:
    - http:
      uri: "<silo:comp_uid>"
    - json
    - simple_key: "<data_key>"
low_code:
  version: 2.0
  id: FirstName
  steps:
    - http:
      uri: "/api/account/1"
    - json
    - simple_key: "contact_fname"

Bulk Snippet

Bulk Snippets are designed to improve performance when the same network request can service many collections. This means that if you need substitution during a Requestor, there is limited or no benefit to Bulk Snippets. On the other hand, if your substitution is happening during a processor, Bulk Snippets will reduce the number of network requests and improve overall performance. As an example you would want to use a bulk snippet if you are using a component UID when selecting the result using the jsonpath step.

Note

The Snippet Framework will execute bulk collection if the application type is configured to Bulk Snippet.