Rogue Wave Server Studio > Rogue Wave Server Studio Advanced Features > Creating Multiple-Row-Type Table Representations
 
Creating Multiple-Row-Type Table Representations
Multiple-row-type tables are designed to store objects from more than one server relation in the same table. For example:
Figure 15.7    Department/Employee Model
A Department has two lists of employees: employees and executives. We want to store all regular employees and executives for a department in the same table.To create this multiple-row-type table in Rogue Wave Server Studio, do the following:
1. Open the Server Data Source inspector and connect it to a running server model.
2. Expand the Department class.
3. Drag the first relation you want to represent to the bottom pane (employees).
A new table representation is created.
4. Hold down the Shift key and drag the second relation you want to represent to the bottom pane (executives).
A new row is created in the same table.
5. Select the first relation you have dragged and map the attributes of its target object to the first row, if applicable.
6. Select the second relation you have dragged and map the attributes of its target object to the second row, if applicable.
This generates the following view specification:
subscribe origin Department:
represent IlsSwTable table:
string column[1]="name";
string column[2]="monthCost";
string column[3]="hireDate";
...
propagate employees;
propagate executives;
subscribe Employee:
represent IlsSwRow employeeRow when isEmployee():
mandatory Ref<IlsSwTable> table=view.origin->table;
string column[1]=name;
int column[2]=monthCost;
int column[3]=hireDate;
represent IlsSwRow executiveRow when isExecutive():
mandatory Ref<IlsSwTable> table=view.origin->table;
string column[1]=name;
int column[2]=monthCost;
int column[3]=hireDate;
Both rows are attached to the same table. At execution time, Rogue Wave Server will subscribe and propagate notification to both relations, so that both employees and executives will be represented in the same table. To avoid row duplication—due to each employee being represented by two rows—you must specify a representation condition that will be true for only one row type. Use the Conditions notebook page in Rogue Wave Server Studio to specify representation conditions.
You can find more information about multiple-row-type tables in the Server/Views mapping in “Multiple-Row-Type Tables”..

Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.