createRecipe

[ Function ]

public static createRecipe (
    recipeName: string,
    path: string | null,
    recipe: TcHmi.Server.RecipeManagement.Recipe,
    callback: null | ((this: void, data: TcHmi.IResultObject) => void) = null
): TcHmi.IErrorDetails;

Creates a new recipe.

Parameter

Name

Type

Description

recipeName

string

Name of the recipe. The name may include the full path. In this case, '::' must be used as the separator for folders.

path

string

Path of the destination folder. If this is not specified, the recipe is created in the main folder.

recipe

TcHmi.Server.RecipeManagement.Recipe

Recipe definition

path

string

Path of the destination folder. If this is not specified, the recipe type is created in the main folder.

callback [ optional ]

(data: TcHmi.IResultObject) => void, null

Asynchronous callback function that is triggered once the action is completed.

Return value

Type

Description

TcHmi.IErrorDetails

Returns confirmation as to whether the operation was successfully sent.

createRecipe 1:

Available from version 1.10.1171.142

Sample - JavaScript

let recipe = {
    'recipeTypeName': 'cookieRecipeType',
    'values': {
        'PLC1.MAIN.sugar': 8
    }
};
TcHmi.Server.RecipeManagement.createRecipe(
    'recipe10',
    'testRecipeCategory',
    recipe,
    function(data) {
        if (data.error === TcHmi.Errors.NONE) {
            // Success
        } else {
            // Error
        }
    }
);

// or the same:
TcHmi.Server.RecipeManagement.createRecipe(
    'testRecipeCategory::recipe10',
    null, // or ''
    recipe,
    function(data) {
        if (data.error === TcHmi.Errors.NONE) {
            // Success
        } else {
            // Error
        }
    }
);