Recipe Import/Export Perspective

Sepasoft MES Module Suite

Recipe Import/Export - Perspective

Note MES 4.0 Only - introduced in 4.83.3 SP2

The Recipe Import/Export component is a compact Import/Export toolbar for custom Perspective screens. It imports and exports transposed recipe-value CSV for a single configured MES equipment path—independently of the Settings Tree Editor and of the Vision Multiple Recipe Editor table.

Use this component when an operator or engineer needs to download recipe values for one piece of equipment, or load a CSV of those values, without opening a full settings tree.

Installed with the Production module (Settings and Changeover).

Find this component under the Ignition Designer Perspective Component Palette in the Settings and Changeover category, named Recipe Import/Export. Component type: mes.recipe.recipeImportExport. Default meta name: recipeImportExport.

The toolbar has two actions:

  • Import — file picker that accepts .csv. The file is written to props.importCsv and imported onto props.equipmentPath.

  • Export — builds CSV from the configured equipment and recipe names and downloads it in the browser.

You can hide the toolbar with style.display = none and still call importRecipes() / exportRecipes() from a script.

Important: Recipe names in props.recipeNames are exact names of enabled recipes assigned directly to that equipment. * and ? are treated as literal characters, not wildcards. Names that are not assigned to the equipment are skipped (and reported in props.messages).

This component does not replace Settings Tree Editor XML import/export. It uses the same transposed CSV shape as the Vision Multiple Recipe Editor table.

Capabilities

Capability

Description

Export recipe values

Download RFC 4180 CSV of setpoint values for the configured equipment and recipe names.

Import recipe values

Load that CSV (or an equivalent file) onto the same equipment.

Gate by recipe list

Only recipes listed in props.recipeNames that are assigned to the equipment are exported or imported.

Type-safe import

If any cell on a recipe cannot be converted to the setpoint’s configured data type, that entire recipe is left unchanged. Other valid recipes in the same file still import.

Partial CSV

Omitted rows or columns are not written. Existing values that are not in the file are not cleared.

Status and messages

props.status and props.messages report progress and errors for bindings and scripts.

Scripted operations

importRecipes() and exportRecipes() run the same Gateway operations as the buttons.

Hidden chrome

Set style.display to none to keep the component mounted for scripts without showing the toolbar.

What this component does not do:

  • Create equipment or setpoint definitions. Those must already exist on the equipment.

  • Import or export Settings Tree Editor XML.

  • Use wildcard or prefix matching on recipe names.

  • Export all recipes on the equipment when recipeNames is empty (export requires at least one name).

Component Properties

Properties can be set in the Perspective Property Editor or through scripting. The section prefix is included before the property name (props, position, custom, or meta).

Python
comp = self.getSibling("recipeImportExport")
comp.props.equipmentPath = "Enterprise\\Site\\Packaging\\Packaging Line 1"
comp.props.recipeNames = ["Mixed Nuts 8oz", "Cashews 8oz"]
comp.props.changeNote = "Shift handover backup"

Name

Scripting

Property Type

Description

Equipment Path

equipmentPath

String

MES equipment path to import onto and export from. Required for both operations. Leave blank until equipment is selected; import and export fail until a path is set.

Recipe Names

recipeNames

Array of String

Exact recipe names to include. Entries are trimmed; empty entries are ignored. Pattern characters (*, ?) are treated literally. Only enabled recipes assigned directly to this equipment are used. Export requires at least one name.

Import CSV

importCsv

String

Transposed CSV payload. Usually set by the Import file picker. May also be bound or set by script before calling importRecipes().

Change Note

changeNote

String

Note stored on recipe import/export changelog events.

Messages

messages

Array of String

Result messages written by the component after an operation. Empty means no errors were reported. Do not treat this as an input.

Status

status

String

Last operation status, written by the component. See Status. Do not treat this as an input.

Style

style

Style Object

Perspective style applied to the toolbar container. Set display to none to hide the buttons while keeping script methods available. Refer to the Ignition Style Reference for classes, colors, fonts, and related settings.

Status

props.status is written by the Gateway during and after each operation.

Value

Meaning

idle

No operation has run yet (initial value).

importing

Import is in progress. Import and Export buttons are disabled.

exporting

Export is in progress. Import and Export buttons are disabled.

success

Last operation completed without reported messages.

error

Last operation failed, or import reported one or more messages. See props.messages.


Position, Custom, and Meta Properties

Position — Component layout properties. Refer to Ignition Perspective Component Properties for details. Default size is 120 × 56 pixels.

Custom — New user-defined custom properties can be created in this section. Best practice: if user-defined properties are required, create them here rather than under Meta.

Meta — Contains the name and visibility properties for the component. Default name: recipeImportExport.


Runtime Behavior

Binding equipment and recipes

  • Set props.equipmentPath to the production equipment path (often bound from an equipment selector or session property).

  • Set props.recipeNames to the exact recipe names assigned to that equipment (often bound from a Recipe Selector).

  • Optionally set props.changeNote.

  • Bind props.status and props.messages to labels or a table if operators should see results.

If equipmentPath is blank, import and export fail with an error message and status error.

Export

  • Operator clicks Export, or a script calls exportRecipes().

  • Status becomes exporting. Buttons are disabled.

  • The Gateway keeps only recipe names that are assigned to the exact equipment path. Unassigned names are added to props.messages. If none remain, export stops with status error and no file is downloaded.

  • CSV is built: column 0 is Value Name; each remaining column is a resolved recipe name; each row is one equipment default setpoint (sorted by setpoint sort order, then name).

  • The browser downloads {equipment-leaf}-recipes.csv (unsafe characters in the leaf name are replaced with _).

  • Status becomes success (unassigned-name warnings may still be in props.messages).

Export filename examples:

Equipment path

Download name

Site/Area/Line/Mixer

Mixer-recipes.csv

(blank)

Export does not run; if a name were built with no path it would be recipes-export.csv

Import

  • Operator clicks Import and chooses a .csv file, or a script sets props.importCsv and calls importRecipes().

  • The file picker writes the file contents to props.importCsv and sends that payload to the Gateway (the event payload is used so import does not race a lagged property write).

  • Status becomes importing. Buttons are disabled.

  • Recipes in the CSV that are not in props.recipeNames, or are not assigned to the equipment, are skipped and reported.

  • Setpoint names that are not defined on the equipment are skipped and reported.

  • For each remaining recipe: if any cell fails conversion to the setpoint’s default data type, no cells for that recipe are applied. Other recipes in the file still import.

  • Only cells present in the CSV are written. Omitted setpoints keep their stored values.

  • Status becomes success if there are no messages, otherwise error. props.messages lists skipped recipes, unknown value names, type errors, and save failures.

Empty CSV fails with Empty CSV data.

Type validation (Perspective only)

Perspective CSV import refuses type-mismatched cells at whole-recipe grain. Vision Multiple Recipe Editor import does not use this check.

Situation

Result

Recipe A has one invalid cell; recipe B is fully valid

A is unchanged; B is imported; messages include the rejected cell

Cell type matches the equipment default definition

Cell is imported; no type-conversion message

No default setpoint definition for that value name

Cell is rejected; the recipe is not created or changed for that import

Errors operators may see

Situation

Result

Equipment path blank

Equipment path is required to import/export recipe values. Status error.

Export with no recipe names

At least one recipe name is required in recipeNames to export recipe values.

Recipe name not assigned to the equipment

Recipe ({name}) is not assigned to equipment ({path}). That recipe is omitted.

CSV recipe column not in recipeNames

Recipe '{name}' does not exist in the current table. It will not be imported.

CSV setpoint not defined on the equipment

Recipe value name '{name}' does not exist in the current table. It will not be imported.

Type mismatch on any cell of a recipe

That recipe is not applied; other recipes continue.

Empty CSV

Empty CSV data.


CSV format

The file is transposed: recipes are columns, setpoint names are rows. Values are RFC 4180 quoted fields with CRLF line endings. Tab- or semicolon-separated files are accepted on import.

Header row: Value Name, then one column per recipe name.

Data rows: setpoint name, then one cell per recipe.

Code
"Value Name","Mixed Nuts 8oz","Cashews 8oz"
"Line Speed","20","22"
"Temperature","350","375"


Column

Meaning

Value Name

Setpoint name. Must match a default recipe value on the equipment.

Each later column

Exact recipe name. Must be listed in props.recipeNames and assigned to the equipment.

Recipe names that contain commas are valid (the name is a quoted CSV field). Export preserves those names.

This is the same layout used by the Vision Multiple Recipe Editor table export, so files can be shared between Vision and this Perspective component. Perspective import applies type validation; Vision import does not.

Component Methods

These methods are callable from Perspective scripts on the component.

importRecipes()

Imports props.importCsv onto props.equipmentPath for recipes in props.recipeNames. Same Gateway path as the Import button (without choosing a file). Set importCsv first.

Code
comp = self.getSibling("recipeImportExport")
comp.props.importCsv = csvText
comp.importRecipes()

exportRecipes()

Exports the configured equipment and recipe names and triggers a browser download. Same Gateway path as the Export button.

Code
self.getSibling("recipeImportExport").exportRecipes()

Component Events

Event

Direction

When

ImportRecipesEvent

Client → Gateway

Import button (payload includes importCsv) or equivalent scripted import.

ExportRecipesEvent

Client → Gateway

Export button. Inputs come from component props; the payload has no fields.

Scripts should call importRecipes() / exportRecipes() rather than firing these events manually.

Configuration Examples


Example 1 — Operator toolbar for a selected line

Bind equipment and recipes from other components. Leave importCsv for the file picker. Show messages under the toolbar.

Property

Example value

equipmentPath

Bound to selected equipment path

recipeNames

Bound to selected recipe name(s), e.g. ["Mixed Nuts 8oz"]

changeNote

Operator CSV update

messages / status

Bound to a Label or Table

Operator clicks Export to download {line}-recipes.csv, edits the file, then Import to apply it.

Example 2 — Two recipes on the same equipment

Property

Example value

equipmentPath

Enterprise\Site\Packaging\Packaging Line 1

recipeNames

["Mixed Nuts 8oz", "Cashews 8oz"]

Export includes both columns. Import updates only recipes that remain assigned to that line. A type-invalid cell in Mixed Nuts leaves that recipe unchanged and still imports Cashews.

Example 3 — Scripted import with hidden toolbar

Hide the chrome and drive import from a custom button:

Python
comp = self.getSibling("recipeImportExport")
comp.props.style.display = "none"
comp.props.equipmentPath = selectedPath
comp.props.recipeNames = selectedRecipes
comp.props.changeNote = "Nightly restore"
comp.props.importCsv = system.file.readFileAsString("C:/Temp/Mixer-recipes.csv")
comp.importRecipes()

Example 4 — Scripted export

Python
comp = self.getSibling("recipeImportExport")
comp.props.equipmentPath = "Site/Area/Line/Mixer"
comp.props.recipeNames = ["Recipe A", "Recipe B"]
comp.props.changeNote = "Weekly backup"
comp.exportRecipes()

The browser downloads Mixer-recipes.csv.

Example 5 — Gate import to one recipe in a multi-column file

The CSV may contain extra recipe columns. Set recipeNames to the one recipe that should be applied. Other columns are reported in props.messages and are not imported.


Sepasoft MES Module Suite