Customizing Apex using Oracle Application Express
From ThemesWiki
| Official Page |
| Project Documentation |
| Download |
|
When we run an APEX application that's generated using the conversion tool, we will encounter a few things that are easily adjusted as well as some parts of the application that need a bit more work. In this tutorial, we will learn some ways to adjust and customize the defaults in this application.
Contents |
[edit] The home page
The home page in our newly-generated APEX application is based on the blocks which were generated into pages, and not the original menu file (_mmb.xml). When we take a look at the screen, we see a lot of things we need to change. This is done in the page properties within the Application Builder in APEX. In the following screenshot, we see what the home page looks like just after generation:
As we see in the home page, we have some names that just aren't that pretty, except for the Block titles that we updated in the project. We need to change some of these names in the Application Builder. To do so, we go to the region definition of the Navigation region on the first page of our application. Here we see a list with the names and links in the Source region, as shown in the following screenshot:
In this Source region in the region definition, there is a link to the list that's used to create this menu on our home page. When we click on the list name Navigation_1 in our example, we go to the following screen where we can edit the names and images used in the home page:
Here, we see the Sequence, Name, and Target page in the application for all the elements on the home page. In our example, we will need to change the names of S_ORD, S_ITEM, and S_INVENTORY in order to create a good-looking and functional menu on the home page. First, let's change the name of the S_ORD menu item. Click on the name and it will take us to the Entry field where we can change the name, which is shown here:
Here we can alter the name of the S_ORD menu item to a name we like and which makes more sense to the users. In my case, I changed it to Orders. We can also change the Image that will be used in the menu, but let's just stick to the name right now. We can also change the names for S_ITEM and S_INVENTORY in the same way.
Now when we take a look at the home page, we see that it already looks a lot better than it did before:
[edit] Lists of Values
Now that we have changed the home page and it all looks a bit better for our users, we would like to take another look inside the application to edit the application and make it more functional and useful for the users. First, we will take a look at the functionality in our new APEX application.
In the home page, we click on the link to Maintain Customer, which will take us to a report page in which the customers are listed.
When we click on an Edit link in front of one customer, or on the Create button, the application takes us to the Maintain Customer form as shown in the following screenshot:
In this form, we need to enter a Sales Rep Id to assign a customer to a sales representative. This is, as we can imagine, not entirely functional for users who don't know all the IDs in the system by heart. So let's change this for them.
In the shared components of our application, we go to the Lists of Values section. This is shown in the following screenshot:
As we already saw in the Maintain Customer form inside the application, a List of Values exists for the credit rating. Now we are going to create a new LOV for the sales representative. To do this, we click on the Create button on the top right of the page.
In the create LOV wizard, we will choose to create a dynamic list of values and give it a functional name. In this example, we named the LOV SALES_REPRESENTATIVES. When we get to the page where we can edit a SQL query, we can insert one to obtain the data we need. As we see in the following screenshot, we insert the query to only return these employees in the Sales department:
Let's now edit the page containing the Maintain Customer form, in our example Page: 5, to use a LOV instead of the numeric ID in the form. To edit this functionality, we need to click on the name of the item we want to change in the form. In this case, it is item P5_SALES_REP_ID.
In the Name section, we change the Display As value from the Text field to the Select List field. Now we scroll down to the Lists of Values section and select Named LOV SALES_REPRESETATIVES as the value.
When we run the page, it will look like the page shown in the next screenshot. We see that we created a drop-down list where the user can select the sales representative who's responsible for the customer in question.
We may also want to change the label in front of the drop-down list because we are still asking for an ID, but the user selects a name. We can change this in the item P5_SALES_REP_ID. The user will only see the name of the sales representative, but we will save the sales representative's ID in the database. This creates a more usable application for us.
Of course, we can follow the same steps with other ID fields such as the region ID in this particular form in the newly-generated application. Once we have created an LOV in our application, we can also use it in different forms in the application. In the S_ORD form, we also encounter the sales representative's ID Item. Just change the value of the displayed section as a Select List, change the display name, and set the value of the named LOV. We will get the form that looks like the following screenshot:
[edit] Validations
To help a user understand the business rules that are in the application, we want to have some clear validation messages. In Oracle Forms we have the When Validate triggers that can be very helpful to do this, and in APEX we have something called validations. We have one of these triggers in our S_ORD block. It's used to tell the user that the date an order is shipped can never be before the date it's ordered. We will put this validation into our APEX application.
When we take a look inside page 7 in our generated APEX application, we see that there already are some validations in place.
All these standard Validations that are in place are defined by APEX itself in order to validate the data that's entered in the specific item. These validations are defined by examining the data types that are in the tables or views that the page is built on.
Now, we will define our own validation on the P7_DATE_SHIPPED item. We learned from the WHEN_VALIDATE_RECORD trigger in the Forms Converter's S_ORD Block that when the shipping date is before the order date, we need to raise an error message telling us that it's wrong. To create a new validation, we click on the plus icon in the Validations section in the Application Builder. This takes us to the next page.
In this first page in the Create Validation wizard, we need to define on what level we need the validation. In our case, we want the validation only on the Date Shipped item, so we select the value of Item level validation instead of Page level. Click on Next to go further and define the validation.
In this page, we can enter the values that define the validation. In the Validation field we enter the validation itself, which is the query or summation that defines what we want to check. When the event occurs, APEX gives the user Error Message. In our example, we want the user to know that it's not allowed to enter a ship date that occurs before the order date. So we enter the text we want in the Error Message field.
Now, we can check if the validation works the way we want it to. Click on the Run button on page 7 and fill in the values in an order. Make sure you enter a ship date that occurs before the date ordered and click on Apply Changes. We see the error message we entered in two places on top of the screen in the error box and on the left of the field that contains the Date Shipped.
[edit] Back to the project page
We already discussed that the project page in our Conversion project is always leading. Now that we have done some work on the APEX application, we want to track the changes we made in the project page. To edit the progress in here, we need to go to the elements in the conversion project and complete them.
For example, take a look at Annotations in the WHEN_VALIDATE_RECORD trigger for which we just created an APEX validation in the Date Shipped item on page 7. We navigate to the triggers in the Orders Forms application on the project page and select the trigger in question. Let's take a look at the Annotations section.
We have implemented the trigger in the APEX application, and now we can alter the value of the Complete field. Set it to Yes and we will see that the completion of our project has proceeded. In the same way, we can go through all the applicable elements in our project that have not yet been completed.
[edit] Titles and names
One of the easiest ways to edit the look and feel of an application is to edit the names and titles in the application. This gives the user a better understanding of the functionality in an application, and we can better tell how the system works.
When we look at the title on top of our application, we notice that it still has the same name we gave it when we created it. And let's face it, nobody would like to work with an application that's called FormsConversion1, would they?
To change the title of an application, we need to navigate to the shared components page in the Application Builder. In the shared components, we go to the Application Definition.
In the Application Definition screen, we go to the Logo section. Here we can alter the logo or name of the application. We have the possibility to enter a link to an image that can function as a logo for our application. But in this example, we just give the application a functional name; in my case Order Management Module. Click on Apply Changes to confirm the new title for our application.
Now, when we run the application, we can see the changes that we made to it. Now we have a correct and functional title for our newly generated APEX application.
We can do the same to titles of pages, regions, and even labels of items. In this way, we can create a fully functional and logical application.
[edit] Additional References
- For instructions on Installing Oracle Essbase, click here
- For instructions on Installing Oracle VM Manager, click here
- For instructions on Debugging Oracle Scheduler, click here
- For instructions on Troubleshooting VM Manager, click here
[edit] Source
The source of this content is Chapter 3: Customizing Apex using Oracle Application Express of Oracle Application Express Forms Converter by Douwe Pieter van den Bos (Packt Publishing, 2009).logo design by Kevin Josh 2010
Executive Editor Sean Lopez own : SEO Company and provider of Link Building Services and SEO Services
And Like Costumes and Halloween Costumes
And Like The Global Information Network and Global Information Network
