Entry Unit

From WebRatio WebML Wiki

Jump to: navigation, search


Contents

Introduction

The Entry Unit

The Entry Unit is a Content Unit used to display a form. For example, using the Entry Unit, we can design a search pattern or a data entry form.

The structure of the Entry Unit is customizable adding fields, selection fields and multi selection fields. Moreover it's possible to draw outgoing links in order to submit the information within the form and incoming links to preload fields.

Properties

The Entry Unit Properties View
  • Id: The unique key automatically assigned by WebRatio to identify the Unit (e.g. enu1).
  • Name: A meaningful name for the Unit, used as label (e.g. employee).
  • Field Order: The display order of the fields (e.g. Nationality,Name).
  • Validation Order: The order of validation rules (if any) applied to the entire form.
  • Link Order: The order of the outgoing links (if any) that will be applied to the links placed on each row of the list.
  • Custom Descriptor: A flag stating that the Unit uses a Custom Descriptor.


Configuration

An Entry Unit can be configured through a context menu that can be reached either right clicking on the Unit in the Work Area or in the Outline View. The context menu contains the following options:

The Context Menu of the Entry Unit
The Validation Rule Properties View
  • Add Link: Adds an outgoing link to the Unit which can be used to transport information and eventually to activate different actions (such as adding new content to the page, reaching another page with new content, activating operation chains).
  • Add Property: Adds a custom property to the Unit. A Property is composed by Name and Value and permits to mark the element for different purposes.
  • Add Field: Adds an input field to the Unit.
  • Add Selection Field: Adds a Selection Field to the Unit having two predefined slots: the former for the label, the latter for the output values of the options.
  • Add Multi Selection Field: Adds a Multi Selection Field to the Unit having two predefined slots: the former for the label, the latter for the output values of the options.
  • Add Validation Rule: Adds a Validation Rule to the Unit.
  • Convert To: Opens a dialog in which it's possible to choose, among the compatible units, the one the Unit should be converted to.
  • Field Wizard: Opens the Field Wizard which allows to quickly add fields, selection fields and multiselection fields to the Unit.


Input and Output

The Input and the Output of the Unit are accessible through the Parameters Coupling window of incoming and outgoing Links respectively.

Input

Input configuration of the Entry Unit

The input of the Entry Unit consists of all the fields, selection fields and multi selection fields specified on the Unit. The fields considered are those having the "Preload" property enabled. Selection fields and multiselection fields are automatically taken into account proposing two items: one for the label and one for the output. The number of items can be changed using the slots on the fields. To access the Output Parameters, open the Parameters Coupling dialog with a double-click or by selecting the "Coupling" property on an incoming link to the Entry Unit.



Output

Output configuration of the Entry Unit

The output of the Entry Unit consists of all the fields, selection fields and multiselection fields specified on the Unit. The configuration window is like the one shown in the image. To access the Output Parameters, open the Parameters Coupling dialog with a double-click or by selecting the "Coupling" property on an outgoing link from the Entry Unit.


Examples

The purpose of this section is to show the usage of the Entry Unit through examples. These examples are based on the Data Model shown in the following image.

The Data Model used in the example
This Data Model consists of two Entities : "Company" and "Employee".

The "Company" entity has many attributes, such as "Name", "E-mail", "Nationality", and so on.

The "Employee" entity has attributes such as "Name", "Surname", "Email", "Role" and so on.

An Employee belongs to one Company while, obviously, a Company has many Employees. This is represented with the 1:N Relationship "Company_Employee".

Example 1: Search of employees

Our goal is to give the possibility to the user to search among all the employees in the Data Model. The user will be able to search for employees by name, surname and hire date. In order to accomplish this example, it is necessary to go through the following steps:

  1. Add a Page to the Site View: select the "Page" icon from the palette, and place it on the Site View. Change the page name (setting "Search Employees") and other properties in the Properties View (such as "Home" or "Landmark" properties) to make the page accessible.
  2. Add an Entry Unit to the page: select the Entry Unit icon from the palette and place it inside the page. Change the "Name" property in "Employees Data".
  3. Define the Entry Unit fields:right click on the Entry Unit and select the Field Wizard option. In the opened dialog pane, select the Employee Entity. In the next pane, select the "name", "surname" and "hire date" attributes.
  4. Add an Index Unit to the page: select the Index Unit icon from the palette and place it inside the page. Change the "Name" property in "Found Employees".
  5. Set the Entity on which the Index Unit is based: click on the "Edit" button next to the "Entity" property in the Properties View. Then choose the "Employee" Entity from the opened dialog pane.
  6. Choose which attributes of the selected Entity must be shown: click on the "Edit" button of the "Display Attributes" property. Then choose the "name", "surname", "hire date" and "email" attributes from the opened dialog.
  7. Define the sort criteria of the Index Unit: click on the "Edit" button next to the "Sort Attributes" property, then choose the "surname" attribute and the "ascending" sort criteria.
  8. Add the Condition for the Name-based search: right click on the Index Unit and choose "Add Attributes Condition" from the Context Menu. Select the newly added Condition from the Outline View and configure the properties as follow:
    • Name="Employee name"
    • Attributes="name"
    • Predicate="Begins With (Ignore Case)"
    • Boolean Operator="Or"
    • Value=""
    • Required="False"
  9. Add the Condition for the Surname-based search: right click on the Index Unit and choose "Add Attributes Condition" from the Context Menu. Select the newly added Condition from the Outline View and configure the properties as follow:
    • Name="Employee surname"
    • Attributes="surname"
    • Predicate="Begins With (Ignore Case)"
    • Boolean Operator="Or"
    • Value=""
    • Required="False"
  10. Add the Condition for the Hire Date-based search: right click on the Index Unit and choose "Add Attributes Condition" from the Context Menu. Select the newly added Condition from the Outline View and configure the properties as follow:
    • Name="Employee hire date"
    • Attributes="hire date"
    • Predicate="Less or Equal"
    • Boolean Operator="Or"
    • Value=""
    • Required="False"
  11. Set the Default Policy: expand the Index Unit in the Outline View and select the Selector sub-element. In the Property View set the "Default Policy" property to the "Empty(only with Not Required)" value.
    Nota Setting the Default Policy to "Fill", with all the Conditions with the Required Property set False, means that by default the Unit will show all the employees. The "Empty" values means that at least one search criteria must be provided in order to populate the list
  12. Draw a normal link between the "Employee Data" Entry Unit and the "Found Employees" Index Unit: select the Link button from the palette and click on the "Employee Data" Entry Unit (the Source of the Link) and then on the "Found Employees" Index Unit (the Target of the Link). Set the Name property of the newly created Link to "Search" and the Type property to "normal".
  13. Define the parameters coupling: open the Parameters Coupling window of the newly created link in order to define the coupling between the output parameters of the source Unit and the input parameters of the target Unit.In the Parameters Coupling dialog, couple the "name" Field of the Entry Unit with the "Employee name" Attribute Condition of the Index Unit, the "surname" Field of the Entry Unit with the "Employee surname" Attribute Condition of the Index Unit, the "hire date" Field of the Entry Unit with the "Employee hire date" Attribute Condition of the Index Unit.
  14. Generate the Web application: click on "Generate Full Web Project" on the WebRatio Menu Bar. Once the generation process has completed, it is possible to start the application server and test the Web application.
The Web Model of the example
The Properties View of the Entry Unit
The Properties View of the Index Unit
The Parameters Coupling window
The generated Web application

Possible Enhancement

Our goal is to give the possibility to the user to search among all the employees in the Data Model even by selecting the Company of which show the related employees. In order to accomplish this example, it is necessary to go through the following steps:

  1. Add a Selection Field to the Entry unit: right click on the Entry unit and select "Add Selection Field". Set the "Name" property of the Selection Field to "Company"
  2. Add the Condition for the Related Company-based search: right click on the Index Unit and choose "Add Relationship Role Condition" from the Context Menu. Select the newly added Condition from the Outline View and configure the properties as follow:
    • Name="Employee Company"
    • Role="CompanyToEmployee"
    • Predicate="In"
    • Required="False"
  3. Change the Parameters Coupling: open the Parameters Coupling window of the link between the Entry Unit and the Index Unit.In the Parameters Coupling dialog, couple the "company" Selection Field of the Entry Unit with the "Employee Company" Relationship role Condition of the Index Unit.
  4. Add a Selector Unit to the page: select the Selector Unit icon from the palette and place it inside the page. Change the "Name" property in "All Companies".
  5. Set the Entity on which the Selector Unit is based: click on the "Edit" button next to the "Entity" property in the Properties View. Then choose the "Company" Entity from the opened dialog pane.
    Nota Since we need to display all the companies contained in the Company Entity, we do not need to define Conditions, so that all instances of the Company Entity will be retrieved.
  6. Define the sort criteria of the Selector Unit: click on the "Edit" button next to the "Sort Attributes" property, then choose the "name" attribute and the "ascending" sort criteria.
  7. Draw a transport link between the "All Companies" Selector Unit and the "Employee Data" Entry Unit: select the Link button from the palette and click on the "All Companies" Selector Unit (the Source of the Link) and then on the "Employee Data" Entry Unit (the Target of the Link). Set the Name property of the newly created Link to "Companies data passing" and the Type property to "transport".
  8. Define the parameters coupling: open the Parameters Coupling window of the newly created link in order to define the coupling between the output parameters of the source Unit and the input parameters of the target Unit.In the Parameters Coupling dialog, couple the "oid" Attribute of the Selector Unit with the "company [output]" Selection Field Slot of the Entry Unit and the "name" Attribute of the Selector Unit with the "company [label]" Selection Field Slot of the Entry Unit.
  9. Generate the Web application: click on "Generate Full Web Project" on the WebRatio Menu Bar. Once the generation process has completed, it is possible to start the application server and test the Web application.
The Web Model of the enhanced example
The Parameters Coupling window of the "Search" link
The Properties View of the Selector Unit
The Parameters Coupling window of the "Companies data passing" link
The generated Web application

Example 2: Insert New Employee

Our goal is to give the possibility to the user to store new employees data in the application. The user will be able to define all the new employee data and save them in the Data Model. In order to accomplish this example, it is necessary to go through the following steps:

  1. Add a Page to the Site View: select the "Page" icon from the palette, and place it on the Site View. Change the page name (setting "Insert a new Employee") and other properties in the Properties View (such as "Home" or "Landmark" properties) to make the page accessible.
  2. Add an Entry Unit to the page: select the Entry Unit icon from the palette and place it inside the page. Change the "Name" property in "Employee Data".
  3. Define the Entry Unit fields:right click on the Entry Unit and select the Field Wizard option. In the opened dialog pane, select the Employee Entity. In the next pane, select the "name", "surname", "email", "birth date", "hire date" and "role" attributes. In order to choose the Company the new employee belongs to, select the "EmployeeToCompany [1:N]" Relationship Role.
  4. Add a Selector Unit to the page: select the Selector Unit icon from the palette and place it inside the page. Change the "Name" property in "All Companies".
  5. Set the Entity on which the Selector Unit is based: click on the "Edit" button next to the "Entity" property in the Properties View. Then choose the "Company" Entity from the opened dialog pane.
  6. Define the sort criteria of the Selector Unit: click on the "Edit" button next to the "Sort Attributes" property, then choose the "name" attribute and the "ascending" sort criteria.
  7. Draw a transport link between the "All Companies" Selector Unit and the "Employee Data" Entry Unit: select the Link button from the palette and click on the "All Companies" Selector Unit (the Source of the Link) and then on the "Employee Data" Entry Unit (the Target of the Link). Set the Name property of the newly created Link to "Companies data passing" and the Type property to "transport".
  8. Define the parameters coupling: open the Parameters Coupling window of the newly created link in order to define the coupling between the output parameters of the source Unit and the input parameters of the target Unit.In the Parameters Coupling dialog, couple the "oid" Attribute of the Selector Unit with the "Company [output]" Selection Field Slot of the Entry Unit and the "name" Attribute of the Selector Unit with the "Company [label]" Selection Field Slot of the Entry Unit.
  9. Add a Data Unit to the page: select the Data Unit icon from the palette and place it inside the page. Change the "Name" property in "New Employee".
  10. Set the Entity on which the Data Unit is based: click on the "Edit" button next to the "Entity" property in the Properties View. Then choose the "Employee" Entity from the opened dialog pane.
  11. Choose which attributes of the selected Entity must be shown: click on the "Edit" button of the "Display Attributes" property. Then choose the Data Unit attributes from the opened dialog.
  12. Add a Create Unit: select the Create Unit icon from the palette and place it inside the Web Model. Change the "Name" property in "Create a new Employee".
  13. Set the Entity on which the Create Unit is based: click on the "Edit" button next to the "Entity" property in the Properties View. Then choose the "Employee" Entity from the opened dialog pane.
  14. Draw a normal link between the "Employee Data" Entry Unit and the "Create a new Employee" Create Unit: select the Link button from the palette and click on the "Employee Data" Entry Unit (the Source of the Link) and then on the "Create a new Employee" Create Unit (the Target of the Link). Set the Name property of the newly created Link to "Save" and the Type property to "normal".
  15. Define the parameters coupling: open the Parameters Coupling window of the newly created link in order to define the coupling between the output parameters of the source Unit and the input parameters of the target Unit.In the Parameters Coupling dialog, press the Guess Coupling button. WebRatio will automatically couple all the Input Parameters with the Output Parameters.
    Nota The Guess Coupling functionality will perform a name comparison between Input and Output Parameters guessing possible coupling. It is particularly useful to use it with the Field Wizard functionality, since it will create the Fields with the same names of the Entity Attributes.
  16. Draw an OK link between the "Create a new Employee" Create Unit and the "New Employee" Data Unit: select the Link button from the palette and click on the "Create a new Employee" Create Unit (the Source of the OK Link) and then on the "New Employee" Data Unit (the Target of the OK Link). Set the Name property of the newly created OK Link to "Employee created".
  17. Define the parameters coupling: open the Parameters Coupling window of the newly created link in order to define the coupling between the output parameters of the source Unit and the input parameters of the target Unit.In the Parameters Coupling dialog, couple the "oid" Attribute of the Selector Unit with the "Company [output]" Selection Field Slot of the Entry Unit and the "name" Attribute of the Selector Unit with the "Company [label]" Selection Field Slot of the Entry Unit.
  18. Generate the Web application: click on "Generate Full Web Project" on the WebRatio Menu Bar. Once the generation process has completed, it is possible to start the application server and test the Web application.
The Web Model of the example
The Properties View of the Entry Unit
The Properties View of the Selector Unit
The Parameters Coupling window of the transport link
The Properties View of the Data Unit
The Properties View of the Create Unit
The Parameters Coupling window of the normal link
The Parameters Coupling window of the OK link
The generated Web application

Example 3: Modify an Employee

Our goal is to give the possibility to the user to select and modify the data of an employee in the application. In order to accomplish this example, it is necessary to go through the following steps:

  1. Add a Page to the Site View: select the "Page" icon from the palette, and place it on the Site View. Change the page name (setting "odify an Employee") and other properties in the Properties View (such as "Home" or "Landmark" properties) to make the page accessible.
  2. Add a Power Index Unit to the page: select the Power Index Unit icon from the palette and place it inside the page. Change the "Name" property in "Employee List".
  3. Set the Entity on which the Power Index Unit is based: click on the "Edit" button next to the "Entity" property in the Properties View. Then choose the "Employee" Entity from the opened dialog pane.
  4. Choose which attributes of the selected Entity must be shown: click on the "Edit" button of the "Display Attributes" property. Then choose the "name", "surname", "hire date" and "company" attributes from the opened dialog.
  5. Define the sort criteria of the Power Index Unit: click on the "Edit" button next to the "Default Sort Attributes" property, then choose the "surname" attribute and the "ascending" sort criteria. Since the Power Index Unit is dinamically sortable, set the "Sortable" property to true and the "Sort History Size" property to 1.
  6. Define the division of the Employee List in pages: select the Power Index Unit, set the "Block Factor" property to "10" and the "Block Window" property to "10".
  7. Add an Entry Unit to the page: select the Entry Unit icon from the palette and place it inside the page. Change the "Name" property in "Employee Data".
  8. Define the Entry Unit fields:right click on the Entry Unit and select the Field Wizard option. In the opened dialog pane, select the Employee Entity. In the next pane, select the "oid", "name", "surname", "email", "birth date", "hire date" and "role" attributes. In order to modify the Company the employee belongs to, select the "EmployeeToCompany [1:N]" Relationship Role. Since all the Fields will be preloaded with the information of the selected employee, select the "Mark new fields as preloaded" checkbox.
  9. Hide the "oid" Field: expand the Entry Unit in the Outline View and select the Oid Field. In the Property View, select the "Hidden" property and deselect the "Modifiable" property.
  10. Draw a normal link between the "Employee List" Power Index Unit and the "Employee Data" Entry Unit: select the Link button from the palette and click on the "Employee List" Power Index Unit (the Source of the Link) and then on the "Employee Data" Entry Unit (the Target of the Link). Set the Name property of the newly created Link to "Modify" and the Type property to "normal".
  11. Define the parameters coupling: open the Parameters Coupling window of the newly created link in order to define the coupling between the output parameters of the source Unit and the input parameters of the target Unit.In the Parameters Coupling dialog, couple the "oid" Attribute of the Power Index Unit with the "oid" Field of the Entry Unit,the "name" Attribute of the Power Index Unit with the "name" Field of the Entry Unit,the "surname" Attribute of the Power Index Unit with the "surname" Field of the Entry Unit,the "hire date" Attribute of the Power Index Unit with the "hire date" Field of the Entry Unit and the EmployeeToCompany.oid parameter (the primary key of the Companty the Employee is connected to) with the "Company - Preselection" Selection Field Slot.
  12. Add a Selector Unit to the page: select the Selector Unit icon from the palette and place it inside the page. Change the "Name" property in "All Companies".
  13. Set the Entity on which the Selector Unit is based: click on the "Edit" button next to the "Entity" property in the Properties View. Then choose the "Company" Entity from the opened dialog pane.
  14. Define the sort criteria of the Selector Unit: click on the "Edit" button next to the "Sort Attributes" property, then choose the "name" attribute and the "ascending" sort criteria.
  15. Draw a transport link between the "All Companies" Selector Unit and the "Employee Data" Entry Unit: select the Link button from the palette and click on the "All Companies" Selector Unit (the Source of the Link) and then on the "Employee Data" Entry Unit (the Target of the Link). Set the Name property of the newly created Link to "Companies data passing" and the Type property to "transport".
  16. Define the parameters coupling: open the Parameters Coupling window of the newly created link in order to define the coupling between the output parameters of the source Unit and the input parameters of the target Unit.In the Parameters Coupling dialog, couple the "oid" Attribute of the Selector Unit with the "Company [output]" Selection Field Slot of the Entry Unit and the "name" Attribute of the Selector Unit with the "Company [label]" Selection Field Slot of the Entry Unit.
  17. Add a Data Unit to the page: select the Data Unit icon from the palette and place it inside the page. Change the "Name" property in "Modified Employee".
  18. Set the Entity on which the Data Unit is based: click on the "Edit" button next to the "Entity" property in the Properties View. Then choose the "Employee" Entity from the opened dialog pane.
  19. Choose which attributes of the selected Entity must be shown: click on the "Edit" button of the "Display Attributes" property. Then choose the Data Unit attributes from the opened dialog.
  20. Add a Modify Unit: select the Modify Unit icon from the palette and place it inside the Web Model. Change the "Name" property in "Modify Employee".
  21. Set the Entity on which the Modify Unit is based: click on the "Edit" button next to the "Entity" property in the Properties View. Then choose the "Employee" Entity from the opened dialog pane.
  22. Draw a normal link between the "Employee Data" Entry Unit and the "Modify Employee" Modify Unit: select the Link button from the palette and click on the "Employee Data" Entry Unit (the Source of the Link) and then on the "Modify Employee" Modify Unit (the Target of the Link). Set the Name property of the newly created Link to "Save" and the Type property to "normal".
  23. Define the parameters coupling: open the Parameters Coupling window of the newly created link in order to define the coupling between the output parameters of the source Unit and the input parameters of the target Unit.In the Parameters Coupling dialog, press the Guess Coupling button. WebRatio will automatically couple all the Input Parameters with the Output Parameters. Then couple the "oid" Field of the Entry Unit with the automatically created Key Condition of the Modify Unit {{Note|The Guess Coupling functionality will perform a name comparison between Input and Output Parameters guessing possible coupling. It is particulary useful to use it with the Field Wizard functionality, since it will create the Fields with the same names of the Entity Attributes.
  24. Draw an OK link between the "Modify Employee" Modify Unit and the "Modified Employee" Data Unit: select the Link button from the palette and click on the "Modify Employee" Modify Unit (the Source of the OK Link) and then on the "Modified Employee" Data Unit (the Target of the OK Link). Set the Name property of the newly created OK Link to "Employee modified".
  25. Define the parameters coupling: open the Parameters Coupling window of the newly created link in order to define the coupling between the output parameters of the source Unit and the input parameters of the target Unit.In the Parameters Coupling dialog, couple the "oid" Attribute of the Modify Unit with the automatically created Key Condition of the Data Unit
  26. Generate the Web application: click on "Generate Full Web Project" on the WebRatio Menu Bar. Once the generation process has completed, it is possible to start the application server and test the Web application.
The Web Model of the example
The Properties View of the Power Index Unit
The Properties View of the Entry Unit
The "Modify" Link Parameters Coupling window
The Properties View of the Selector Unit
The "Companies data passing" Link Parameters Coupling window
The Properties View of the Data Unit
The Properties View of the Modify Unit
The "Save" Link Parameters Coupling window
The OK Link Parameters Coupling window
The generated Web application


Related articles:
Category Difficulty Refers
Context Parameters Web Model Beginner Get Unit
Set Unit
Reset Unit
Create Unit Web Model Beginner Create Unit
Create a "Hello world" application Web Model Beginner Site View
WebML
WebRatio
Create a "Simple data centric" web application Web Model Beginner Site View
WebML
WebRatio
Custom Locations and Master pages Web Model Beginner Master Page
Custom Location
… further results












Did you find this article useful? Please rate it!

Rating: 5.0/5 (4 votes cast)

Personal tools