Use the open database icon to open the database. Use the default user admin and
password admin.
Use the open report from database icon to access the examples. Please note you will find more examples
to be imported in the installation examples/projects
directory.
Hands on example
In this tutorial we will take as input an XML document which contains the
list of employees for each department. We want to create a PDF file with
the list of departments and for each department the list of employees.
We will start running the FO Designer and we get an empty template.
First we load the XSD file departmentEmployees.xsd. The result
will be.
as an alternative (if we do not have a XSD file), we can click on the create
schema from XML button and load the XML document
departmentEmployees.xml. This would read the XML document and list
of existing XML nodes, as a result it would create a kind of "virtual"
schema.
As second step we copy and paste the XML test file in the XML
test files folder departmentEmployees.xml. As you can
see this file contains 2 departments:
Our template will use 2 areas, the header area for the name of the
department and the
detail area for the employees. So first we will tell FO Designer we want
to have a header area for each department in the XML document. So we
click on the header area title button to display the properties of the
area and we set/departments/department.
furthermore we set the New page property (in the control tab) to
true because we want to have a new page for each
department.
Now we do something similar with the detail area, we click on the
detail are title button and set the XML Node to/departments/department/person,
since we want to have a detail line for each employee,
furthermore, you have to make sure the XML Node type is
relative since we want to list only the employees of the current
department.
Note also we have set visibility flag in the detail header area to false
because we will not use that area.
We will now add some fields to the header area. Click on the
button and place the following fields in the header area:
the only properties you must change are:
value = List of employees
font = size 18
font color=red
next you add 2 more fields, the properties you have to set are:
value property of the left field = Department:
value property of the right field = empty
name property of the right field = DepartmentName
XPath property of the right field =
/departments/department/departmentName
Now we can test the template by clicking on the PDF button The output will be a PDF file with two pages:
As next step you can proceed adding the fields in the detail
area:
the three fields on the left have ablackborder
because we have defined the constant property to true.
For all these 3 fields you have to:
drag the field tool
to the place in the area
change the constant property to true and the value property to the
value you see in the screenshot (Name:, Address: and Status:)
Add 2 variable fields (the ones with blue borders) and select
as Xpath/departments/department/person/nameand/departments/department/person/address
the third variable field is actually a combo box and must be defined
like this:
Drag the combo box tool to the area
Set the XPath to /departments/department/person/status
The Keys list must be defined as in this screenshot:
in this way the values A and I which are contained in
the XML document will be replaced with the more descriptive values
"Active" and "Inactive".
We can test the template by clicking on the PDF button
The output will now contain the detail information (persons):
we can also add a line to separate the persons, note we added in
this screenshot a line object:
The output is now:
And last we will add a counter field in the template footer.
This field has the following special handling:
We have used the count()function in the Xpath
to counter the number of persons in the department.
We use the XPath type absolute which means the Xpath
will be issued exactly as we enter it.
The XPath itself references only the person node. The
reason for this is, the footer is implicitly dependent on the header
and the header is associated to the department node.
It would also be correct to set the relative and the
XPath to count(/departments/department/person). However
the use of functions and the xpath type relative is in this version of
the designer not supported.
Oracle, APEX, Java, JSP, JDBC, JDK and all Java-based marks
are trademarks or registered trademarks of Oracle and/or its
affiliates. J4L Components is independent of Oracle.