Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Reusable Snippets is an advanced concept introduced to the Strategy Designer in the Caribou Lou release (v14). It allows users to extract a group of blocks into what is called a snippet, which can then be reused across multiple strategies while being maintained in one central location. This concept is quite similar to a function in programming.

In this section:

Table of Contents
stylenone

Creating

a snippet

Snippet

There are three ways to create a snippet:

Add button

Add Button

When you click the Add button in the Snippets tab, a new , empty snippet is created in the draft state.

image-20250117-172200.png

Extract Block

to

To Snippet

When designing a strategy, you can right-click on a block and select "choose Extract Block to Snippet." This action will create a draft snippet containing that includes the selected block, and while the original block in the strategy will be replaced by the newly created snippet.

See the following images:

image-20250117-173310.png
image-20250117-173501.png
image-20250117-173506.png

Import

Importing is done in the same way as importing any other entity. Please refer to the Import / Export (Strategy Designer).

Anatomy

of the

Of The Snippet

block

Block

A Snippet block is very similar to a function in programming. It can have arguments and needs to return a single value.

image-20250117-170923.pngImage Added

Arguments

The snippet has includes arguments that are used to accept values from the strategy, enabling users to dynamically modify the snippet's behavior. Each argument has a name, a type, and a default value,

image-20250117-170923.pngImage Removed

and it will be rendered as an input field within the snippet block when used in a strategy.

This is how a snippet defined above would look in a strategy:

image-20250118-172327.pngImage Added

Creating a new version

When you create a new version of a snippet, you will enter a special edit mode. In this mode, you cannot change the arguments or the return value type. This restriction is in place to maintain compatibility with the strategies that the snippet is used in. If the arguments or the return value type were to change, the snippet block would become disconnected.