Dynamic View Services > Specifying Dynamic View Types > Server Object Subtypes and View Type Specification > Using Narrowing in Expressions
 
Using Narrowing in Expressions
It is sometimes necessary to reference attributes of a subtype when specifying representation attributes or conditions. For instance, suppose you want to visualize only the employees who are themselves managers in ManagerView.
The following specification fulfills your new requirement:
view ManagerView :
subscribe origin Manager:
represent TableR table when (view.origin==this):...
propagate managed when (view.origin==this);
propagate Employee when (view.origin!=this);
 
subscribe Employee:
represent RowR row when Manager:...
The expression when Manager is interpreted by trying to downcast the employee to the Manager subtype. The condition is true if the actual type of the employee is Manager.
When the employee is not a manager, narrowing fails and the expression is evaluated to the default IlsMvValue, which is converted to IlsFalse, because the condition is a Boolean expression. Thus, the employee is not represented.

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