Views File¶
The views file (*.views) contains all views defined by the entity and the view properties and attribute properties. These files are not directly deployable into the database and have to pass through the code generator which produces database deployable apv files. Views files can be empty if no additions or changes to the template generated base views exist.
Note : As defined in Entities, you need to consider Row Level Security concerns in the Views File.
Base views files¶
In the Base views files the following are defined:
- Column definitions for all attributes in all the model files
- Base view definition
The only view that exists in the base views file is the Base View. The properties set on the base view comes from the entity model. You are not supposed to change anything in the base view file, it should be completely generated.
COLUMN Object_Group_Id IS
Flags = 'KMI--'
Datatype = 'STRING(30)/UPPERCASE'
Prompt = 'Object Group Id';
COLUMN Description IS
Flags = 'AMIUL'
Datatype = 'STRING(200)'
Prompt = 'Description';
COLUMN Queue_Id IS
Flags = 'AMIUL'
Datatype = 'NUMBER'
Prompt = 'Queue ID';
Core views file¶
In core views file you can:
- Add new views
- Override the baseview
- Overtake the base view
Note: When defining a new view in the views file you can either select from tables or from other views from the same views file. Other kind of views has to be defined in separate SQL scripts.
VIEW Dictionary_Sys_Domain IS
Service = 'Dictionary'
Prompt = 'Domain values in Logical Unit Dictionary'
Lu_Name.Flags = 'PM--L'
Lu_Name.Datatype = 'STRING(30)'
Lu_Name.Prompt = 'Logical Unit Name'
Package_Name.Flags = 'PM--L'
Package_Name.Datatype = 'STRING(30)'
Package_Name.Prompt = 'Package Name'
Db_Value.Flags = 'KM--L'
Db_Value.Datatype = 'STRING(60)'
Db_Value.Prompt = 'Database Value'
Client_Value.Flags = 'AM--L'
Client_Value.Datatype = 'STRING(120)'
Client_Value.Prompt = 'Client Value'
SELECT lu_name lu_name,
package_name package_name,
db_value db_value,
client_value client_value,
rowid objid
FROM dictionary_sys_domain_tab;
Deployment order vs public and private view definitions¶
If there are dependencies between view definitions, please observe that public views will be deployed first. These are the views that are placed in the following section of the .views file:
-------------------- PUBLIC VIEW DEFINITIONS --------------------------------
If the base view is overridden, and even its definiton placed under the private views section, it will still be deployed first, since it is a public view. So, if the base view relies on another view, make sure to define the other view in the public view definitions section, and the overridden base view definition after.
Customization views file¶
In customization views files you can:
- Add new views
- Override all the views from Core and Base layer
- Overtake all the views from Core and Base layer
View properties¶
View properties can be added or changed in the beginning of the View definition clause. Example of properties to change are:
- Prompt
- Objversion
Example of adding view properties:
VIEW Person_Info IS
Prompt = 'Person Info'
Objversion = 'to_char(rowversion)'
Attribute properties¶
Adding view attribute properties is done by adding these in the beginning of the view definition. You must prefix the property with your attribute name, view properties are not prefixed.Below is an example of adding attribute properties on a new view:
VIEW Overtake_View_Lov IS
Prompt = 'Overtake View Lov'
Description.Datatype = 'STRING(200)'
Description.Prompt = 'Name of Overtaken views'
Description.Flags = 'A----'
SELECT
object_group_id object_group_id,
nvl(Basic_Data_Translation_API.Get_Basic_Data_Translation('ENTERP', 'OvertakeView', object_group_id ), decscription) description,
queue_id queue_id,
rowkey objkey
FROM overtake_view_tab;
¶
Column properties versus View attribute properties¶
The difference between COLUMN properties versus VIEW attribute properties is that the COLUMN properties are valid for all views and VIEWS attribute properties are only valid for that view. If you have many views with the same column name it is easier to use COLUMN properties instead and only define them once for all views. You do not need to specify the COLUMN or VIEW attribute properties if they are the same as in the model, only when you have a difference.
Syntax COLUMN¶
COLUMN Object_Group_Id IS
Flags = 'P----'
Datatype = 'STRING(30)'
Prompt = 'Object Group Id';
Syntax View Attribute¶
VIEW Overtake_View_LOV IS
Description.Datatype = 'STRING(200)'
Description.Prompt = 'Name of Overtaken view'
Description.Flags = 'A----'
...
Types of properties¶
The following types of properties exist:
Flags¶
The flags describes the attribute properties. The flags to use are the same as the flags on an attribute, see attribute flags.
Datatype¶
The data type describes if the attribute is number, date, string, Boolean etc. Some of the data types can have a format, the format is usually optional. The property data type to use is the same as the data type on an attribute, see data type. Observe that TEXT should be STRING in the views file.
Enumeration¶
The enumeration is used when an attribute has list of values that should be used. You specify yourself which enumeration to be used.
Prompt¶
The prompt is used to define another name of the attribute to be displayed.
Ref¶
The ref is used when an attribute has a reference from an other attribute in an other entity. You specify yourself which reference to be used.
Examples¶
VIEW Xlr_Wb_Collection_Pub IS
Process_Status.Flags = 'AMIU-'
Process_Status.Datatype = 'STRING(200)'
Process_Status.Enumeration = 'XlrWriteBackStatus'
Process_Status.Prompt = 'Process Status'
Process_Status.Ref = 'XlrWriteBackStatus'
...