Display a grid as a list

You can reference a grid, and display it on another form as a list.

To configure the list correctly, it can help to understand how Unica Plan stores grids.

  • A list view is read-only and displays all of the rows in a specified database table.
  • A grid view is either editable or read-only. The rows in the grid "belong" to the parent of the grid; that is, to the project or marketing object instance that includes the grid on one of its custom forms.

For example, if users create two projects from the same template, the rows added by the corresponding grids in both projects are added to the same database table, but the grid for each project has access to only its own data.

To achieve this, a database table that holds grid data must have two columns: one to uniquely identify each row, and one to identify the parent ID: the ID of the project or marketing object that contains the grid.

The Table Key Column that you set for a grid holds the parent ID for the row. All rows in a single grid have the same value for this column. As a result, it does not uniquely identify a row of data.

The Forms Editor automatically generates a column, uap_grid_row_id, for each grid. A list view just requires a column that uniquely identifies rows. Therefore, to use the same table as the grid for a list view, you can specify uap_grid_row_id as the key column for the list. Do not use the same key column that you specified when you specified the grid data table.

Example

To illustrate, look at this example:

  • The Tradeshow template contains a custom tab, Staff. The form for the Staff tab contains a grid.
  • Two tradeshow projects exist, TRS001 and TRS002.
  • TRS001 and TRS002 have object IDs of 121 and 122 respectively.
  • Data exists in the Staff grid for both TRS001 and TRS002.

The database table that holds the data for these two grids might look like the following illustration:


Table with columns for object_id, uap_grid_row_id, manager, emp_id, emp_name, and salary

The first several rows belong to the grid on TRS001. The final few rows belong to the grid on TRS002.

Each project displays only its own portion of the data in this table. However, if there is a list that uses this table for reference, it displays all the rows in the table, as shown here:


Grid with columns for Employee ID, Name, Base Pay, and Manager

Since the column name uap_grid_row_id is reserved, you must not use this as a column name when you specify the columns for the grid.

You can filter a list so that it displays only the grid entries from its own object (project or marketing object). Continuing the previous example, create a project template that includes two custom tabs:

  • Staff Form: contains a grid that you use to enter and edit members of the staff.
  • Staff List: displays the entries from the Staff Form grid as a list.

To ensure that only the entries from the current project display on the Staff List tab, filter on the parent ID of the list.

When you create the grid component for the list, set the following values:

  • Filter By Parent ID: selected.
  • Parent Id Column Name: object_id (as shown in the database table earlier in this example). This value must match the value in the Table Key Column for the grid.