Legal | Privacy
Building a Calendar Using Oracle HTML DB Release 2

Building a Calendar Using Oracle HTML DB

This tutorial shows you how to build a calendar page using Oracle HTML DB. This calendar will include a link to a report displaying details.

Approximately 30 minutes

This tutorial will discuss the following topics:

Overview
Prerequisites
Building and Viewing Database Objects
Loading the Data

Creating an Application

Building a Report
Building the Calendar
Running the Calendar Application
Summary

Place the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: Because this action loads all screenshots simultaneously, response time may be slow depending on your Internet connection.)

Note: Alternatively, you can place the cursor over each individual icon in the following steps to load and view only the screenshot associated with that step.

What Is HTML DB?

HTML DB provides a declarative development framework for creating database-centric Web applications. Development is done using an online service. Deployment is done by downloading a run-time module and your application and running the application within your enterprise.

What Components Make Up HTML DB?

HTML DB contains three main components. You will use all three components throughout this tutorial.

Application Builder

Using the Application Builder, you can build database-centric interactive Web applications.

SQL Workshop The SQL Workshop enables you to run SQL statements and SQL scripts.
Data Workshop With the Data Workshop, you can load data into and extract data from the database.

Terminology

The following concepts are important to know when working with HTML DB:

Application

An application is a collection of pages with branches that connect them. Its attributes include the authentication method, default UI templates, and authorization rules.

Page A page is defined by how it is rendered or displayed and by how it is processed. Processing refers to the events and logic that occur when the page is submitted. Each page is rendered dynamically at run time from metadata defined by the application developer. How a page looks is controlled by page templates.
Region Content is displayed in regions, which are logical subsections of a page. Each page can have any number of regions of several different types. These types include: HTML text, SQL Queries, PL/SQL-generated HTML, and charts. Each region is rendered using a region template. Regions are positioned on the page using display points defined in the page template.
Item Application items are used to generate HTML form elements. The Applications engine manages the PL/SQL-generated of the HTML, and you as the developer simply choose the item type. Applications support more than 50 such types including date pickers, pop-up lists of values, text areas with spell checking, and so on. The value of an item is automatically stored into the application's session state, which can be referenced at any point within the user's session.

In this Tutorial

In this tutorial you will use the built-in wizard for generating a calendar. Once you specify the table on which the calendar is based, you can create drill down links to information stored in specific columns.

Oracle HTML DB supports two calendar types:

Easy Calendar: creates a calendar based on schema, table, and columns you specify. The wizard prompts you to select a date column and display column.
SQL Calendar: creates a calendar based on a SQL query you provide. The SQL SELECT statement you provide must include at least two columns, a date column and display column. The calendar application you create in this tutorial will be of this type.

The date column determines which days on the calendar will contain entries. The display column defines a specific row that will display a calendar date.

Projects This table will track all current projects.
People This table will contain information about who can be assigned to handle issues.
Issues This table will hold all the information about an issue, including the project to which it is related and the person assigned to rectify the issue.

Below is a simple Entity Relationship Diagram (ERD) displaying how the three tables relate to one another.

Additional database objects, such as sequences and triggers, will also be needed to support the tables. System generated primary keys will be used for all tables so that all the data can be edited without needing to implement cascade update.

Before starting this tutorial, you should have:

1.

Completed the Installing and Configuring Oracle HTML DB 1.6 tutorial or have access to an already installed HTML DB 1.6 installation.

 

2.

Downloaded and unzipped htmldbcal.zip into your working directory.

 

Back to Topic List

There are several ways that objects can be created using Oracle HTML DB. They are all functions of the SQL Workshop:

1. Use Create Object from the main SQL Workshop page. This function walks through all the choices necessary to create the selected object type.
2. Use the SQL Command Processor from the main SQL Workshop page. This runs commands that you type or paste in. The processor can only process one command at a time.
3. Upload a script, using Scripts from the main SQL Workshop page. This script would contain the create object statements. Once the script is uploaded, it can then be run.
4. Create a script on-line. This way all the objects will be created with just a few clicks without the need to first save a file to your hard drive. This is the method you will use in this tutorial.

To create the objects necessary for this Calendar application, perform the following steps:

1.

Enter the following URL to log in to HTML DB.

http://<host name>:<port>/pls/htmldb/htmldb

 

2.

To log in to HTML DB, enter the following details, and click Login.

Workspace: obe
Username: obe
Password: obe

Move your mouse over this icon to see the image

 

3.

To create the table that the application will be based on, click SQL Workshop.

Move your mouse over this icon to see the image

 

4.

Under SQL Scripts, Click Scripts.

Move your mouse over this icon to see the image

 

5.

Click Create.

Move your mouse over this icon to see the image

 

6.

Enter DDL for Calendar for the Name and click Next.

Move your mouse over this icon to see the image

 

7.

Copy and paste the SQL located in the calddl.sql file in your working directory to the Script field. Then click Create Script .

Move your mouse over this icon to see the image

 

8.

Your script has been created. Click Run.

Move your mouse over this icon to see the image

 

9.

Make sure that OBE is selected for Parse As and click Run Script.

Move your mouse over this icon to see the image

 

10.

Your script was executed and the Summary Statistics page appears. You should see that there are 52 successes and no errors. Now you can view the objects you created. Click the breadcrumb SQL Workshop.

Move your mouse over this icon to see the image

 

11.

Under Database Browser, click Tables.

Move your mouse over this icon to see the image

 

12.

Make sure OBE is selected from the list of Schemas.

Move your mouse over this icon to see the image

 

13.

To view the details of an object, click the magnifying glass () icon next to the HT_PEOPLE table.

Move your mouse over this icon to see the image

 

14.

The table details are displayed. Now you are ready to load the data into the objects you just created. Click the Data Workshop tab.

Move your mouse over this icon to see the image

 

To properly view the application that you will create, you need data loaded into the tables. Data can be loaded in manually, via an Oracle import, or using the Oracle HTML DB Data Workshop or SQL Workshop. You will use both the Data Workshop and SQL Workshop to load your data.

Note: If you look at the DDL, you notice that the sequences used for the primary keys were set to start at 40. That was to leave room for the data. The before insert triggers were coded in such a way that the sequence is only accessed if a primary key value is not provided. This was done so that they will not need to be disabled in order for you to load data.

You need to perform the following tasks:

Load Project Data
Update Project Dates
Load People Data
Load Issues Data

Load Project Data

The Projects data will be loaded using the Data Workshop. You can import text data, xml data or spreadsheet data. You will import text data using the Projects data contained in the load_projects.txt file. Perform the following steps:

1.

From the Data Workshop tab, under Data Import, click Import Text Data.

Move your mouse over this icon to see the image

 

2.

Import To an Existing Table and Import From Copy and Paste, then click Next.

Move your mouse over this icon to see the image

 

3.

Make sure the OBE Schema is selected and click Next.

Move your mouse over this icon to see the image

 

4.

Click the icon to search for a Table.

Move your mouse over this icon to see the image

 

5.

Select HT_PROJECTS (table).

Move your mouse over this icon to see the image

 

6.

Click Next.

Move your mouse over this icon to see the image

 

7.

Copy and paste the text located in the load_projects.txt file in your working directory into the Data field. Then click Next.

Move your mouse over this icon to see the image

 

8.

Click Import Data.

Move your mouse over this icon to see the image

 

9.

The HT_PROJECTS table now contains data. You should see that 5 records succeeded and 0 records failed. Click the SQL Workshop tab.

Move your mouse over this icon to see the image

 

Update Project Dates

The Projects have been created but the dates need to be updated to make the projects current. To do this, you will create a script and run it. Perform the following steps:

1.

Under SQL Scripts, click Scripts.

Move your mouse over this icon to see the image

 

2.

Click Create.

Move your mouse over this icon to see the image

 

3.

Enter Update Project Dates for the Script Name and click Next.

Move your mouse over this icon to see the image

 

4.

Copy and paste the text located in the update_project_dates.sql file in your working directory into the Script field. Then click Create Script .

Move your mouse over this icon to see the image

 

5.

Your script has been created. Click Run.

Move your mouse over this icon to see the image

 

6.

Make sure that OBE is selected for Parse As and click Run Script.

Move your mouse over this icon to see the image

 

7.

Your script was executed and the Summary Statistics window appears. You should see that there are 4 successes and no errors. Now you can load the people data. Click the breadcrumb Script Repository .

Move your mouse over this icon to see the image

 

Load People Data

You will load the People data by creating a script and running it. You will import text data using the People data contained in the load_people.sql file. Perform the following steps:

1.

Click Create.

Move your mouse over this icon to see the image

 

2.

Enter Load People Data for the Name and click Next.

Move your mouse over this icon to see the image

 

3.

Copy and paste the text located in the load_people.sql file in your working directory into the Script field. Then click Create Script.

Move your mouse over this icon to see the image

 

4.

Your script has been created. Click Run.

Move your mouse over this icon to see the image

 

5.

Make sure that OBE is selected for Parse As and click Run Script.

Move your mouse over this icon to see the image

 

6.

Your script was executed and the Summary Statistics window appears. You should see that there are many successes and no errors. Now you can load the issue data. Click the breadcrumb Script Repository .

Move your mouse over this icon to see the image

 

Load Issues Data

You will load the Issues data by creating a script and running it. You will import text data using the Issues data contained in the load_issues.sql file. Perform the following steps:

1.

Click Create.

Move your mouse over this icon to see the image

 

2.

Enter Load Issues Data for the Name and click Next.

Move your mouse over this icon to see the image

 

3.

Copy and paste the text located in the load_issues.sql file in your working directory into the Scripts field. Then click Create Script.

Move your mouse over this icon to see the image

 

4.

Your script has been created. Click Run.

Move your mouse over this icon to see the image

 

5.

Make sure that OBE is selected for Parse As and click Run Script.

Move your mouse over this icon to see the image

 

6.

Your script was executed and the Summary Statistics window appears. You should see that there are many successes and no errors. Now you are ready to create your application. Click the breadcrumb Workspace OBE.

Move your mouse over this icon to see the image

 

Now that the objects that support the application have been created and the data has been loaded, the user interface can be created. Using the Application Builder, an application will be created and then a page will be created to display Project Tasks on a Calendar.

You can quickly default pages to both report on and create data for selected tables within a schema by using the Create Application Wizard. Alternatively, you can create the application definition and then add pages as desired. The latter method will be used in this tutorial. Perform the following steps:

1.

On the HTML DB home page, click Create Application >.

Move your mouse over this icon to see the image

 

2.

Because you are going to create an application from scratch, keep the default value of From Scratch for the Creation Method, and click Next >.

Move your mouse over this icon to see the image

 

3.

For Name, enter Calendar Application. To specify that the application will have one page, select 1 from the Pages drop-down list. Click Next >.

Move your mouse over this icon to see the image

 

4.

Click No Tabs, and click Next >.

Move your mouse over this icon to see the image

 

5.

Enter Calendar for the Page Name and click Next >.

Move your mouse over this icon to see the image

 

6.

Select Theme 10, and click Next >.

Move your mouse over this icon to see the image

 

7.

Click Create Application.

Move your mouse over this icon to see the image

 

8.

Your application has been created. You can see a preview of the application theme. Click Run.

Move your mouse over this icon to see the image

 

9.

Enter obe for both your username and password and click Login.

Move your mouse over this icon to see the image

 

10.

Your see the Default Home Page.

Move your mouse over this icon to see the image

Although the page has no content, the following items were created:

Navigation Links In the upper right of the screen are two Navigation Bar Entries. They allow the user to Print the current page and to Logout.
Developer Links

At the bottom of the page are developer links. These are displaying because the user who is logged in is also a developer of the application. Regular users, those who have only been granted access to run the application, will not see these links. From left to right, you can:

Edit Application Edit the application
Edit Page 1 Edit the page that is running
New Add a new component to the current page
Session Open a new page with the session details
Debug Show the page in debug mode
Show Edit Links Displays quicklinks next to each object on the page that can be edited. The link will appear to the right of the NavBar items, tabs, region titles, buttons, and items. Clicking on the link will popup a window to edit the object.

 

Login Page

This is the page that you used to login to the application.

 

Templates

A basic set of templates was created within the new application that fit the UI Theme selected.

 

Authentication Schemes

Two authentication schemes were created. Internal Account Credentials is used by default but a scheme for database authentication was also created.

 

 

Now that the application structure has been created, content can be added. You could begin with the calendar but because the calendar will link to a report displaying all the details of the selected Issue, you will begin with the report. Perform the following tasks:

Create a Report Page
Create an Item for Query Reference
Create a Cancel Button

Create a Report Page

1.

Click Edit Application in the developer links area at the bottom of the page.

Move your mouse over this icon to see the image

 

2.

The Application Builder home page appears with your new application selected. Click Create Page >.

Move your mouse over this icon to see the image

 

3.

Select the Page with Component option, and click Next >.

Move your mouse over this icon to see the image

 

4.

To specify the component that is going to be added to the page, select the Report option. Click Next >.

Move your mouse over this icon to see the image

 

5.

Select the SQL Report option, and click Next >.

Move your mouse over this icon to see the image

 

6.

Enter 2 for the Page and Issue Details for the Page Name. Then click Next >.

Move your mouse over this icon to see the image

 

7.

Select Do not use tabs and click Next >.

Move your mouse over this icon to see the image

 

8.

Copy and paste the text located in the issue_details_rpt.sql file in your working directory into the SQL SELECT area. Then click Next > .

Move your mouse over this icon to see the image

 

9. Make sure that Region Template is set to Reports Region, and Report Template is set to default: vertical report, look 1 (include null columns). Enter View Issue for Region Name and click Next>.

Move your mouse over this icon to see the image

 

10.

Review your selections and click Finish.

Move your mouse over this icon to see the image

 

11.

Your Report page was created successfully.

Move your mouse over this icon to see the image

 

Create an Item for Query Reference

Before you can link to this report, you need to create the item that your query referenced.

1.

Click Edit Page.

Move your mouse over this icon to see the image

 

2.

Under the Items section, click the Create icon ().

Move your mouse over this icon to see the image

 

3.

Select Hidden for the Item Type, and click Next >.

Move your mouse over this icon to see the image

 

4.

Enter P2_ISSUE_ID for the Item Name and click Next >.

Move your mouse over this icon to see the image

 

5.

The value of the item will be set when the page is called so there is nothing to specify on this page. Click Create Item.

Move your mouse over this icon to see the image

 

6.

Your Item was created.

Move your mouse over this icon to see the image

 

Create a Cancel Button

You need to create a button that will return the user back to the Calendar, or calling page.

1.

Under the Buttons section, click the Create icon ().

Move your mouse over this icon to see the image

 

2.

Select View Issue and click Next >.

Move your mouse over this icon to see the image

 

3.

Make sure Create a button in a region position is selected and click Next >.

Move your mouse over this icon to see the image

 

4.

Enter CANCEL for the Button Name. This will automatically appear as the Button Label. Make sure Template Driven is selected for Button Type and Redirect to URL without submitting page is selected for Action. This is appropriate since this page is just for viewing. No processes would fire if the page were submitted so submitting is not necessary. Then click Next >.

Move your mouse over this icon to see the image

 

5.

Make sure Button is selected for Button Template and click Next >.

Move your mouse over this icon to see the image

 

6.

Select Region Template Position #CLOSE# for Position and click Next >.

Move your mouse over this icon to see the image

 

7.

Enter 1 for Page. This will redirect the user back to the Calendar page. Enter 2 for Clear Cache. Whenever a user clicks the Cancel button, the values on page 2 will be cleared. This protects against the user accessing the page without coming from the Calendar and seeing the previous issue. Then click Create Button.

Move your mouse over this icon to see the image

 

8.

Your button was created. Because this tutorial is about how to create a calendar, not how to customize a report, you will leave the report in its default state, however, for a real application, you would want to edit the Report Attributes to refine the column headings.

Move your mouse over this icon to see the image

 

The Calendar you create will be called Target Resolution Dates. It will display each issue that is not yet closed, along with the person that the issue is assigned to and the project that it belongs to, on the day that corresponds to its target resolution date. Perform the following tasks:

Create a Calendar Page
Create a Link to the Report Page

Create a Calendar Page

1.

Enter 1 for Page and click Go.

Move your mouse over this icon to see the image

 

2.

Under the Regions section, click the Create icon ().

Move your mouse over this icon to see the image

 

3.

Select Calendar for Region Type and click Next >.

Move your mouse over this icon to see the image

 

4.

Select SQL Calendar and click Next >.

Move your mouse over this icon to see the image

 

5.

Enter Target Resolution Dates for the Title and click Next >.

Move your mouse over this icon to see the image

 

6.

Copy and paste the text located in the target_resolution.sql file in your working directory into the SQL Query field and click Next >.

Move your mouse over this icon to see the image

 

7.

Select TARGET_RESOLUTION_DATE for the Date Column and DISP for the Display Column. Then click Create Region.

Move your mouse over this icon to see the image

 

8.

The Calendar Page was created successfully.

Move your mouse over this icon to see the image

 

Creating a Link to the Report Page

1.

In the Regions section, select CAL to the left of Target Resolution Dates.

Move your mouse over this icon to see the image

 

2.

Click Column Link.

Move your mouse over this icon to see the image

 

3.

Enter 2 for Page, 2 for Clear Cache, P2_ISSUE_ID for Set these items and #ISSUE_ID# for With these values. Then click the Go To Top icon ( ).

Move your mouse over this icon to see the image

 

4.

Click the Region Definition tab.

Move your mouse over this icon to see the image

 

5.

Click Header and Footer.

Move your mouse over this icon to see the image

 

6.

Enter This excludes Closed issues. for the Region Header and click the Go To Top icon ().

Move your mouse over this icon to see the image

 

7.

Click Apply Changes.

Move your mouse over this icon to see the image

 

8.

The region has been updated.

Move your mouse over this icon to see the image

 

You are now ready to run the application to see the Calendar Application and the Report you created. Perform the following steps:

1.

Click on the Run icon in the upper right corner of the application window.

Move your mouse over this icon to see the image

 

2.

Your Calendar is displayed. You can use the buttons to navigate to the Previous or Next Months. The Today button takes you to the current month. Click on any text displayed for an issue.

Move your mouse over this icon to see the image

 

3.

The View Issue page is displayed with the detail. You can click Cancel to return to the Calendar.

Move your mouse over this icon to see the image

 

Back to Topic List

In this lesson, you learned how to:

Build Database Objects
Load Data using a Script

Build a Calendar that views a detail report

Back to Topic List