Design recipe management

Recommended procedure

Below are the recommended procedures for designing recipe management, with a database in which to store the recipes at runtime:

  1. Configure a Recipe Schema object.

  2. Configure the use of the recipes at runtime.

  3. (Optional) Design the import/export of recipes in CSV format at runtime.

Configure a Recipe Schema object

  1. Right-click Recipes, then select New > Recipe Schema: the new object appears.

  2. To add ingredients, the node that contains the corresponding variables must be indicated: from Project, drag the node of interest onto the value of the Destination node property.

  3. Double-click Recipe Schema: the editor for selecting ingredients opens.

  4. Select the ingredients and click Apply.

    Note

    if the target node contains variables nested in other variables, to display them and select them, in the editor’s toolbar, click image1, then select Show nested variables.

  5. To automatically configure a table in the database in which to store the recipes, do the following:

    1. To set the name of the table, type the name in the Table name property, otherwise leave the property without a value to name the table with the BrowseName of the Recipe Schema.

    2. In the Store property, select the database desired (see Working with databases): a table with a column for each ingredient is automatically configured in the database.

Configure the use of the recipes at runtime

To design the graphical interface and recipe functions available to users at runtime, it is recommended to always start from the Recipes Editor widget included in Q Studio.

The widget can be used as provided (see Recipes Editor) or some of its components can be reused to design a customized solution (see Customize recipe management).

Design the import/export of recipes in CSV format at runtime

To import/export recipes at runtime, Q Studio provides the dedicated RecipeImportExport NetLogic. With it, it is possible to export all the recipes stored in the database associated with the Recipe Schema and/or store the imported recipes in the database associated with the Recipe Schema. Below are the steps for designing the import/export:

  1. Click image2 to open the template library, then from Scripts select RecipeImportExport and drag it into the desired position in Project, for example into the Model folder: the NetLogic RecipeImportExport appears.

  2. In the RecipeSchema property of the NetLogic, select the Recipe Schema of reference object, i.e. the Recipe Schema with the same ingredients of the recipes to import.

  3. In CSVFile, type the full path of the CSV file to export or import, e.g. C:\temp\exportrecipes.csv.

    Note

    the fields of the CSV file to import must be the same as the database columns.

  4. In CSVSeparator, set the CSV field separator.

  5. To delimit the fields in the CSV file with quotation marks, set WrapFields to True.

  6. Configure the buttons to run the import/export:

    • Add a Button object in the desired container, then associate its MouseClick Event event with the NetLogic Export method.

    • Add a Button object in the desired container, then associate its MouseClick Event event with the NetLogic Import method.

See also

Related concepts

Recipes

Related procedures

Recipes Editor

Customize recipe management

References

Recipe schema