xAPPnow Low Code Platform - Working with View Objects
View Objects are specific data objects of the xAPPnow Low Code Platform which provide the possibility to integrate external databases into the business model.
Once the entity relationship model is finished with all tables and relations, the view objects can be configured to access single or associated entities and selective attributes of the entities. View Objetcs can the be used like business objects to implement the business logic. In the following Entity Relationship Model we have an entity "company" wich has relations with other entities such as address, contact, job_request, document, employee and referenced entity margin_company.
Each Entity has a Column Name for the name of the field in the table in your database and other column named Javascript Name which represents the attribute name used in a View Object. The name of a relation between entities is taken from the target entity or can be modified in the General TAB. and also will be an attribute name of a view object.
Add a new View Object
When adding a view object on a Business Object Model automatically a dialog is displayed to configure this view with a table or group of tables. In a first action to configure the View Object, a dialog shows all Entity Relationship Models available to select one.
After the ERM selection, the first step of create the view object is Select Entities, it shows a dialog with a tree of the entities on the selected ERM on the left area, and on the right a list of view objects already added on the current business object model. Only one root entity can be selected on the tree to generate the view object. In the image below the root entity is company as the main entity for the view object generation, and the related entities job_request and placement are included as attributes, also are included the view objects DocumentVO and AddressVO selected on the area on the right. Because of the nature of the relation between these entities (many-to-many and one-to-many), the corresponding attributes will take the name of the relation as indicated between braquets. Once the entities and generated view objects are selected, we can continue to the next step.
After the selection of the entities according to the new view object's goal in the project, the next step is to select the attributes of the entities selected on the previous step. Here we can decide the specific attributes needed for this case. Only the attributes of the entities will be listed, if an existent view object was selected on the previous step, all its attributes are included automatically on the new view object. The view object resultant will only include the selected attributes in this step and the ones of the preexistent selected view objects. This dialog allows to go back to the previous step in case we need to correct the entities selection or finish the view object configuration. We can also cancel the view object configuration at any moment.
In this case, the Attributes Tab of new view object CompanyVO will look like in the image below. Notice that in column Type, the objects can have an implicit object type (identified with the name of the entity plus a suffix like <_DO><number>)or a view object type (identified with the name of an existant view object). These types are assigned depending of the selection made on the first step of the view object configuration: the entities selected on the entities tree will have an implicit type, and the view object selected on the view object area will have a view object type.
The type of relation between the root entity and the rest of the entities selected for the view object, determines if the attributes of complex types (implicit and view object) are marked as [list] in the column List. Notice that, in this case, the attributes marked as [list] correspond with the entities which the root entity has a one-to-many or a many-to-many relationship with.
Modify View Object
If, instead of creating a new view object, you need to modify the entities and the attributes of an existent one, you must right-click over the element to display the context menu and then select the option "Data Object Type". The dialog for the configuration steps will be displayed with the current configuration and you can modify it as needed.
In case you need to modify the ERM selected, select the element and open TAB General to change the Submodel, then you will have to follow all the steps like on the view object creation.
REMARK: In all cases, to modify the name, the user interface properties or the values and validations of the attributes of a view object, it must me changed directly in the columns of the entity of the related ERM, the attributes on a view object are read-only.










