dialogTable

Block Category: Signal Producer

Description: When you attach a data table to a dialogTable block, Embed arranges and presents the information from the data lists in the dialogTable dialog box. For example, the dialog box below lists parametric data for a TB1102 motor:

Click the DOWN ARROW in the Motor Type box to select a different type of motor. When you do so, Embed updates the dialog box with data corresponding to the newly selected motor.

Understanding data tables: If you have used Microsoft Excel, Lotus 1-2-3, or any other spreadsheet program, you are probably familiar with data files. Data tables are similar to data files. Like data files, data tables are made up of a header record and data records.

A data table contains sets of information that describe a particular item. Each of these sets of information is called a data record. For example, one record in a list of motors contains all the information about a specific motor. 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. These field names are stored in the first row of cells in the data table. This row is called the header record. The first cell in the header record contains the item identifier. Once you attach the data table to the dialogTable block, you use the item identifier to choose which data record is to be displayed in the dialog box.

The following illustration shows an Excel data table for five different motors.

The first field name in the header record — the item identifier — is Motor Types. The different types of motors are listed beneath the Motor Types column heading. The remaining field names in the header record are column headings for motor information. For example, the peak force for each motor type is listed in the column of cells labeled Peak Force. Each of the remaining rows of cells, the data records, contains a set of information for a specific motor. When you attach the data table to a dialogTable block, the field names in the header record are listed as parameter names in the dialog box.

 

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 box 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 box for the dialogTable block retrieves and displays data records from the attached CSV data table.

1.    Right-click the dialogTable block.

The Properties dialog box appears, like the one shown below:

The field names in the header record are the parameter names in the dialog box. 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.