Moogsoft Docs

filterByCookbookAndRecipe

A Workflow Engine function that allows you to filter inscape Situations (trigger and swept up) based on their Visualize data. These are inclusive filters and return true if the Visualize data for the Situation matches the cookbook name and recipe name.

This function is available as a feature of the Workflow Engine v1.1 download. See Update the Workflow Engine for information on how to upgrade.

This function is available for Situation workflows only.

Back to Workflow Engine Functions Reference.

Arguments

Workflow Engine function filterByCookbookAndRecipe takes the following arguments:

Name

Required

Type

Description

cookbook

Yes

String

Name of the cookbook to filter by.

recipe

Yes

String

Name of the recipe to filter by.

Example

The following example demonstrates typical use of Workflow Engine function filterByCookbookAndRecipe.

A situation created by the “Description” recipe in the “Default Cookbook“ would produce the following Visualize data:

{
    "visualize": {
        "origin": "Cookbook",
        "cookbook_name": "Default Cookbook",
        "recipe_name": "Description"
    }
}

If you want to check if the cookbook name is Default Cookbook and the recipe name is Description, enter the following:

  • cookbook: Default Cookbook

  • recipe: Description

The UI translates your settings to the following JSON:

{"cookbook":"Default Cookbook","recipe":"Description"}

The function returns true, since both cookbook and recipe match the Visualize data.

Now consider these filters:

{"cookbook":"MyCookbook","recipe":"Description"}

In this case the function returns false, since only recipe matches the Visualize data, while cookbook does not. For the function to return true, both arguments must match the Visualize data.