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:
Configure a Recipe Schema object
Right-click Recipes, then select New > Recipe Schema: the new object appears.
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.
Double-click Recipe Schema: the editor for selecting ingredients opens.
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 , then select Show nested variables.
To automatically configure a table in the database in which to store the recipes, do the following:
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.
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:
Click 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.
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.
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.
In CSVSeparator, set the CSV field separator.
To delimit the fields in the CSV file with quotation marks, set WrapFields to True.
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
Related procedures
References