One of the ways to retrieve a list of data from Business Objects is through Views. Using a visual designer, you can create complex queries that collect information from different Business Objects under different filtering criteria. You can use Views to display data in your pages or reference them in Rules. The advantage of using Views is that you can define a complex query once and reuse it as well as make additional queries against that View.
The Views are structured the same way an SQL Select statement is with the following components:
Property | Description |
---|---|
General | Aside from the basic information, you'll have to make a decision whether to deploy the View as a database element or a function. |
Objects | All of the Busines Objects that are related... |
Fields | All the columns associated with the view |
Where | Clause that filters the retrieved columns |
Sort By | Used to sort view by a specific column(s) |
Group By | Used to group columns and perform aggregate function on other columns. For example finding the total number of employees grouped by position |
Having | Used in conjunction with the Group By statement. Used to Filter the result statement. For example finding number of employees grouped by position having position not equal to 'QA'. |
NOTE: For naming issues please refer AppBase Black List of Names.
This section covers how to create a view that selects attributes from one business object
Enter the following properties as follows
Property | Description |
---|---|
Query Name | Enter a meaningful name. |
API Permanent ID | This field is automatically pre populated and needs to be unique across all Views in your solution. |
Primary Object | This will be the default object when selecting attributes of the business object |
Description | Enter a meaningful description. This description should explain what the Views is displaying |
Select the desired attributes and click on the move button to include in the view
Example of generated code:
SELECT A0.COL_ID ID, A0.COL_LNAME CLIENTLNAME, A0.COL_FNAME CLIENTFNAME, A0.COL_CLIENTID CLIENTCLIENTID From Tbl_Client A0 ORDER BY A0.COL_ID ASC |
Can change |
An example of creating an in clause:
In this example:
|
An example of creating a Compare clause:
In this example:
|
Example of generated code:
SELECT A0.COL_ID ID, A0.COL_ID CLIENTID, A0.COL_FNAME CLIENTFNAME, A0.COL_LNAME CLIENTLNAME FROM TBL_CLIENT A0 Where ((A0.Col_Id In (1, 3, 6) AND A0.COL_FNAME = 'John Doe')); |
Notice that there are three folders in the Object tab
Property | Description |
---|---|
Object | Business Objects created in the solution |
View | Views created in the solution |
Function | Rules deployed as functions in the solution |
Note: For this example the objects folder will be used
Below is an example using a Join with a relation
NOTE: by default the object that is clicked to be edited will be the Right Object
|
Example of generated code:
SELECT A0.COL_ID ID FROM TBL_PATIENT A0 LEFT JOIN TBL_DOCTOR A1 ON (A0.COL_DOCTORPATIENT = A1.COL_ID) |
Note: The having clause is used with conjunction with the group by clause
Below is an example of using field properties of finding the max of a patient
Click on Add Term and fill in the following information
Property | Value |
---|---|
Type | Compare |
Expression 1 | Function : Max, patient.age |
Operation | Greater |
Constant | 14 |
Example of Generated Code
SELECT A0.COL_ID ID, A0.COL_NAME PATIENTNAME, MAX(A0.COL_AGE) PATIENTAGE FROM TBL_PATIENT A0 GROUP BY A0.COL_ID, A0.COL_NAME |
Using the above examples, user can generate complicated views and have a visual reference