Вы находитесь на странице: 1из 10

7/21/2017

ISTN 3SI Finalizing the


Front End
Subtitle

Front End Finalisation

Sort out the errors


Improve the user interface
Add on a reporting sub-system
Add on a Help facility

1
7/21/2017

User Interface (UI)

Improving the UI is not just about aesthetic improvement


it could become quite complicated
It may involve some serious database manipulation!
such as creation of inner joins between tables to provide
a richer display of data
An inner join results in the creation of a new data table

The Point of Sale Database

2
7/21/2017

Inner Join Data Table


If the database relationships are created in the database itself, as
we have done in our point of sales (POS) application, then you
could get some nice inner join processing with very little effort
If the database already has the One to Many relationships
implemented, the dataset displays this relationship as a Parent to
Child (PTC) relationship under the data source window
All you do is drag the relevant tables onto your form and the data
will be displayed as required

A quick reminder of the POS database structure

The dataset reflects the One to Many


relationships as PTC relationships
Customer is the parent of order; Order is the
parent of Order_Product
Order_Product is the child of Product
however, this is not of much help!

3
7/21/2017

Inner join information

As each customer is selected, the customers orders are displayed and as each order is selected,
details of that order are also displayed
However, what if we wanted to know the name of the product ordered as well i.e. as each order
detail is clicked, we would like to know the name and description of the product ordered. We
cannot drag and drop the Product Table and expect this to happen automatically because the
Product table is actually a parent of the Order_Product table not the other way around

A proper inner join


Suppose that we wanted to see a listing of all products purchased by
any specific customer
This kind of query is normally part of a report which will be
covered in the next semester. However, this can also be done via
forms processing
If you look at the dataset design, you will see that the customer
table is not directly linked to the Product table. So a series of inner
joins will have to be created to facilitate retrieval of the data that
we required.
In order to create the join, select the dataset.xsd class file and drag
and drop a table adapter object from the toolbox
The query builder opens up. Add all the bridge tables that will be
required. In our case, all the tables are required

4
7/21/2017

Creating a new data table to match the inner join

The query builder setup is


shown
This will create a new data
table with the required fields
This data table will now be
reflected in your data set which
can now be dragged and
dropped into your application
In our case, the customer name
is repeated. However, if we add
a search method on the table,
then we can select a customer
name and that customers
purchases will be shown but I
will leave that for you to do!

A few adjustments
On the table adapter you need to ensure that the
correct PK has been set. In our case, it will be a
combination of CustomerId and ProductID. A resulting
interface could look like:
and the inner join is done!

5
7/21/2017

The Elegance of Reporting

1. Create a Report that shows all customer details as well as a history of their
orders and the total income generated from each customer.
2. This task is achieved by using the following method:
a. Establish a data source
b. Fill the datasets with data from the database
c. Add on a Crystal Report class
d. Sort out the configuration issues!!
e. Design the class (preferably via the wizard)the design will involve linking of the
Crystal Report to the Datasets (that have been filled with data); the design canvas
for Crystal Reports have many useful functions it is only through experimentation
that you will be able to obtain competitive advantage to ensure an optimal
effect from your report
f. Instantiate the newly designed Report class as a Crystal report document/object
g. View the document via the Crystal report Viewer class

The Report DB Connection

6
7/21/2017

A Primitive Report Class is created

Your are provided with a previewthe actual report with its original
data has not been developed as yet!
The trick now is to re-design the class so that it looks goodand then
instantiate the report

Instantiating the Report

Drag a Crystal Report Viewer object from the Toolbox onto the form
Create an instance of the Crystal Report class by using the Crystal Report
Document to enable the instantiation
Now link up the Crystal Report instance to the Crystal Report Viewer
And finally set the data source for the Crystal report instance (just to avoid a
database login prompt)

7
7/21/2017

and so you should have a very basic


report!
it looks ugly

Some Report Design Fundamentals


The Report Design Canvas is used to design the structure of your report. You can place various elements like charts, test
elements, and data objects in the report.

Report Header
It is used to add Report title at the top or any other information you want to place at the beginning of the report.

Page Header
This option is used to present information at the top of each page like document heading, chapter name, etc. Page header
doesnt come in Report Header.

Body
This is used to show the body of the report. All report data comes in this section.
When you need to separate the data into groups in order to make it easily understood, grouping option can be used.
You can also customize grouping for a single value or multiple values by using the customize option inside the grouping tab.

Report Footer
This is used to present information at the end of the report like totals, etc.

Page Footer
This is used to present page numbers or any other information you want at the end of each page.

8
7/21/2017

Grouping

A group is a set of records that are related to each other


in some way. For example, you might group together all of
your employee in the same Zone. A Group Name field is
created when you insert a group into your report.

9
7/21/2017

Using Grouping and the Canvas


to get a better Report

10

Вам также может понравиться