This topic contains the following sections that describe the format and features of a virtual entity:
Anatomy of a Virtual Entity
This section describes the layout of a virtual entity's Entities record. The figure below illustrates the Entities record for the VirtualLibraryInventory entity, which has been used as an example in the previous sections on the Virtual Entity wizard.
A virtual entity's Entities record includes the following settings:
- Name/Display Name: The Name and Display Name for a virtual entity corresponds to the values you entered in the Virtual Entity Wizard for these fields.
- Base Table: This field reports the name of the virtual entity's base view. A virtual entity has no database table; it obtains its information from the base view, which pulls the data from the data source you specified in the Virtual Entity wizard.
- Base View: This database object is automatically created by the Virtual Entity wizard, using the name you specified.
- Generate Table: The Generate Table option is disabled. Do not select this option for a virtual entity.
- Fields: The Virtual Entity wizard automatically adds a Fields record for each column in the virtual entity's data source. Most of the data in a Fields record, with the exception of Default In View, is not actually used by the virtual entity, since it is not generated and it does not have a corresponding database table or form template. See Default In View for information on this option.
- The following field options are applicable to a virtual entity, so an administrator can modify these settings as needed:
- Show In Find: By default, this option is enabled, and the field can be selected as the filter in the Find dialog.
- Default In View: By default, this option is enabled, and the field is added as a column to new views of the virtual entity. Note that a user can remove the field from a view as necessary.
- Allow Sorting: By default, this option is enabled, and a user can sort a view's results by this field (assuming that the underlying field type supports sorting).
- Allowed Search Method: This field is set to Any by default, which means that there is no search restriction on the field. An administrator can modify the search method on a field-by-field basis as necessary.
- spGetRecord: This database object is automatically created by the Virtual Entity wizard, using the name you specified. See the Stored Proc. tab for a link to the corresponding Database Objects record. Note that this is the only stored procedure that is automatically generated for a virtual entity, since a virtual entity supports read-only access to data.
Working with Virtual Entities
This section highlights some of the uses for a virtual entity in Aptify. It also describes some of the common functions that you cannot perform for virtual entities.
Virtual Entity Features
- Create Views: A user can create any type of view for a virtual entity. This includes list view, chart views, and calendar views. In addition, a list view of a virtual entity supports all of the view formatting options that are available for a standard Aptify entity, including using filters, adding and removing fields, sorting, and view formatting. The figure below illustrates a formatted list view of records from the Library Inventory database, which is stored on another SQL Server on the network.
- The figure below illustrates the same data displayed in a chart view, grouped by Author.
- Run Reports: As with standard Aptify entities, an administrator can write a Crystal Report that pulls data from the virtual entity. Then, after adding the report to Aptify, users can run the Report Wizard to populate the report based on a view's contents.
- Create a Filter Relationship for a Sub-type Virtual Entity: Each top-level record has a one-to-many relationship with its sub-types, which can easily be mapped to a filter relationship. However, you can only create a filter relationship for top-level entities. By using a virtual entity, you essentially give a sub-type entity limited status as a top-level entity. Therefore, one compelling reason to create a virtual entity of a sub-type is to allow filtering based on the sub-type's characteristics. For example, if you create a virtual entity of ProductPrices, you can add a filter relationship to filter a view of Products based on its prices. (See About the Filter Relationships Form for information on creating Filter Relationships.)
- Once this filter relationship exists, you can create views that display products that have a member price, or products with a price of $100, as shown below. Note that by adding a hierarchy (which is standard feature for all sub-type entities), that same pricing information can also be reviewed directly within the Products view, as shown in the prompt view example.
- Consider adding one more condition in the future as time permits: create a view that joins orders and order lines into a single view and then use charting or other view types to look at this type of information
Virtual Entity Caveats
- Cannot Create, Update, or Delete Records: A virtual entity provides read-only access to data. You cannot create, update, or delete records in a virtual entity.
- Cannot Open Records: A virtual entity has no form template by default. So if a user double-clicks on a record in the virtual entity, an error message displays. However, if the virtual entity contains a link to one or more Aptify entities, you can add redirect attributes and the corresponding Viewer plug-in to specify the Aptify record which should be opened when a user attempts to open a record in a virtual entity. See step 12 in Setting Up a Virtual Entity Using the Wizard for more information on these attributes.