Description

When a chart is called from an Ignition component or MES module script, execution begins at the Start Block. Optional user-defined Chart Parameters can be created for passing data values or arrays into and/or back from the chart.

All charts must begin with a Start Block. Therefore, when a new chart is created, a Start Block will already be in place on the Design Grid. The Start Block is mandatory and cannot be deleted.

Connections

Exactly one connection is required:

START — (output) Connects to the first Block in the sequence. When chart execution begins, this connection passes execution control to the first Block in the chart.

It does not matter which edge on the Start Block is used to connect to the first Block in the sequence.

Properties

Parameters may optionally be created to pass data values into and/or back from the chart.

Usage

Connecting the Start Block

  1. Click to select the Start Block.
  2. Create any new Chart Parameters required, as shown below.
  3. Drag into place onto the Design Grid the first Block in the chart sequence.
  4. Click the Start Block again and draw a Connector (line) from any edge over to the new Block. When the chart is executed by one of the chart functions listed in system.mes.bc, the Start output passes execution control to this first Block in the chart sequence.

Configuring (optional) Chart Parameters

Create or Edit a New Chart Parameter

To create a new Chart Parameter, click . To edit an existing Chart Parameter, click or double-click on the parameter.

Configure or edit the Chart Parameter using the Edit Parameter dialog box.

Configure a Simple Data Type Parameter

  1. Name the new parameter in Parameter Name (spaces are not allowed).
  2. Select the Simple Data Type radio button.
  3. Select a data type (String, Integer, Double or Date) from the drop-down list.
  4. If not an array, enter an optional Default Value (quotes are not required around strings).
  5. Click Save to save the parameter (or Cancel to quit the edits).

Configure a B2MML Schema

  1. Name the new parameter in Parameter Name (spaces are not allowed).
  2. Select the B2MML Schema radio button.
  3. Select an available MES B2MML category from the drop-down list.
  4. Click Save to save the parameter (or Cancel to quit the edits).

Configure a Complex Data Type Parameter

A Complex Data Type parameter is either a list or an array presented to the first Block in the chart sequence (as a Python list or dictionary, respectively).

  1. Name the new parameter in Parameter Name (refer to the naming rules here: Complex Data Type Parameters).
  2. Select the Complex Data Type radio button.
  3. Click on the name of your new parameter in the Complex Parameter Structure area.
  4. Click to add a row. Name it and select the Data Type in the Complex Node Editor area on the right. For an array instead of a list, select "Complex" from the Data Type drop-down. This will make this entry eligible for child elements.
  5. Complete the list or array as needed.
  6. Click Save to save the parameter (or Cancel to quit the edits).


Copy/Paste New Complex Nodes

You can use Copy Selected Complex Node ) and Paste Complex Node ) to create new nodes in the Complex Parameter Structure pane. Duplicate parameter names will have an underscore and the next available integer appended (e.g. "_1" then "_2", etc).


Delete a Chart Parameter

To delete a Chart Parameter, click to highlight the parameter and then click .

Copy Selected Parameter to Clipboard

Click to highlight the parameter and then click . This copies the parameter's default value(s) to the clipboard.

Copy Selected Parameter's Default Value(s) as a Python String to Clipboard

Click to highlight the parameter and then click . This copies the parameter's Python dictionary structure to the clipboard as a Python-compliant String. Using the example MaterialCategory shown above, the clipboard will contain all of the dictionary key/value pairs (values are blank, but the quotes for them are present as placeholders (because the child items in this example are defined as type String):

Paste Clipboard to a New Chart Parameter

Once a Chart Parameter has been copied to the clipboard as described above (includes its default value or values), click to paste the clipboard contents into a newly-created parameter (will be named the same but have a suffix of underscore plus the next appropriate digit, such as "_1" then "_2", etc). The new parameter will also contain the original parameter's default value or values.


Example

Create Material Definitions

This example chart collects a list of Material Definitions from an SAP database and creates a MES Material Definition object for each.



Start Block

A Chart Parameter called maxRows is used to limit the number of SAP entries to fetch from the SAP database. The number will be input into the chart during the chart execution function executeChart(chartPath, chartParameters).

Sample SettingDescription
maxRowsInteger type. It will become available for mapping in the SAP RFM Action Block.



SAP RFM Action Block - Properties

This block fetches the Material Definitions from the specified SAP database. It is configured as follows:

A Destination called My SAP Server was previously configured in the Interface for SAP ERP section of the Global area in Designer:





The Remote Function Call section is configured to filter down to just the BAPI_MATERIAL_GETLIST module where the Material Definitions are stored:

PropertySample SettingDescription
NameGet MaterialsName of the Block (available, if needed, for local use within the chart by other Blocks).
DestinationMy SAP ServerSelected SAP Connector Destination (created in the Interface for SAP section of the Global area in Designer).
Function Group Filter*All SAP Groups will pass through the filter (asterisk is a wildcard).
Function Module Filter*material_getlistSAP function call to retrieve the list of material group objects.
Function Group(Any Function Group)The Function Modules for all SAP Function Groups will be available in the Function Module drop-down list.
Function ModuleBAPI_MATERIAL_GETLISTRetrieve only the BAPI Materials list.
Selected RFM(shows the selected Function Module)Display only. Shows the selected Function Module after the Select button is pushed.
RFC TypesRFCSynchronous Remote Function Call (expects an immediate answer from the receiving system, else an error will be reported).
Queue NameN/A



SAP RFM Action Block - Mapping

The Input tab of the SAP RFM Action Block includes mapping for the Chart Parameter maxRows to be passed into the RFM function call that the block makes to the SQL database (limits the number of entries fetched). There is also a requirement that MATNRSELECTION in BAPI_MATERIAL_GETLIST be restricted to positive integer values only.


The Output tab of the SAP RFM Action Block includes mapping for MATERIAL → ID and MATL_DESC → Description. Note that it must first include a mapping connector at the parent level, to provide the block with a means of knowing the array sizes on both sides so it can map the connections properly. Each member of the BAPI_MATERIAL_GETLIST will be mapped into a B2MML array that includes Material Definition properties of ID and Description. These will be turned into MES Material Definition objects by the SAVE MES Object Block (see below).



Save MES Object Block

This block creates an MES Object for each entry in the selected RFM (the drop-down list Target will list all of the Action Blocks in the chart. The filtered RFM in the selected Action Block will be used to create the list of MES Objects). For this example, one MES Material Definition object will be created for each entry in the RFM selected in the "Get Materials" SAP RFM Action Block (up to the limit defined by the Chart Parameter maxRows).

PropertySample SettingDescription
TargetGet Materials

"Get Materials" is the data source selected from the drop-down list of blocks with available data (it's the only choice in this example).




End Block

The End Block has no properties. When control passes to this block, it returns control to the script that executed the chart execution function executeChart(chartPath, chartParameters).




Executing the Chart

This example chart is being executed from a script within a Button component on an Ignition Designer window:


If "10" is entered into the Rows to Fetch text field, then when the Button is pressed:

  • The number in the text field is loaded into numRows.
  • "Fetching 10 rows from BAPI_MATERIAL_GETLIST" is printed to the Output Console.
  • The chart is executed, passing in numRows to the Chart Parameter maxRows in the Start Block. Script execution in the Button script will not wait for the chart to complete its execution, allowing the chart to run independently in the background.


The result of the chart execution is that ten rows are fetched from BAPI_MATERIAL_GETLIST in the SAP database and ten MES Material Definition objects are created:





  • No labels