dialogTable

Block Category: Signal Producer

Description: The dialogTable block lets you create a custom dialog from a comma-separated data table. It also creates output connectors on the block that correspond to the field names in the first row of the data table.

Block Name: Specifies the name of the block.

Data Table: Specifies the name of the data table, or click … to select it. Data tables are CSV or TXT files.

When you attach a data table to a dialogTable block, Embed arranges and presents the information from the data lists in the dialogTable dialog. For example, consider the following data table for five motors:

When you attach the data table to the dialogTable block, the resulting dialogTable dialog looks like this:

Here, the TB1102 motor type shows the corresponding Peak Force, Intermittent Force, Cont Stall Force, Peak Current, 10A Time, and Cont Stall Current contained in the data table. If you select a new motor type, Embed updates the dialog with data corresponding to that motor type.

When you construct a data table, remember these rules:

      A data table contains sets of information that describe a particular item. Each of these sets of information is called a data record. The different types of information — such as, the motor type, its peak force, its intermittent force, and so on — are called fields. Each field must have a unique name. Field names are listed in the first row of cells in the data table. This row is called the header record. The first cell in the header record is the item identifier.

      When you attach the data table to the dialogTable block, the item identifier determines which data record is to be displayed in the dialog. The remaining field names are the remaining parameters in the dialog.

 

Examples

1.  Creating a CSV data table in Excel

To create a data table, you use Excel and save the file in CSV format. If you do not have Excel, you can use Notepad to create a TXT file, as described in the next example.

1.    Start Excel.

Excel opens a new empty workbook.

2.    In the first row of cells, enter the field names for the data table. These field names are the header record.

 

Note that the information in cell A1 must be the item identifier. In the above example, Motor Type is the item identifier.

3.    Beginning in the first cell of the second row, enter the information that corresponds to the field name at the top of the column. Press tab to move to the next cell.

4.    When you have finished entering all the data records, save the file as a CSV file.

5.    Exit Excel.

2.  Creating a data table with Notepad

When you create a data table in Notepad, use the same format as described in the previous example. Then follow these additional rules:

      Separate each cell with a comma or space.

      Start each data record on a new line.

      Save the file in TXT format.

3.  Attaching a data table to a dialogTable block

Attaching a data table identifies the name and location of the file containing the data items and corresponding data records. To attach a data table to a dialogTable block, do the following:

1.    Right-click the dialogTable block.

The following dialog appears:

2.    In the Data Table box, click ... to select the CSV data table.

3.    You can optionally enter a new name for the block in the Block Name box.

4.    Click OK, or press ENTER.

Embed displays the dialogTable block. Note that Embed assigns output connectors to the block that correspond to the field names in the header record of the data table. For example:

For this dialogTable block, the attached data table has seven field names in the header record.

4.  Examining the attached data table

The Properties dialog for the dialogTable block retrieves and displays data records from the attached CSV data table.

1.    Right-click the dialogTable block.

The Properties dialog appears, like the one shown below:

The field names in the header record are the parameter names in the dialog. The information from the first data record is displayed in the text boxes.

2.    To display another data record, click the DOWN ARROW for the first parameter—in this case, Motor Type—and select the item whose data record you want displayed. Embed updates the information in the remaining text boxes accordingly.