You are on page 1of 51

5.

Database

5. Database
This chapter describes various functions regarding Database menu. Database menu can be
used to set the methods of bringing data for printing and of applying data to the report.

5.1. Connect Database


Select Database > Connect Database or click Database Connection( ) on the Database
toolbar, then the dialog box of Connect Database will appear as shown below.
There are several database connecting methods such as ADO Connection, RDAGENT
Connection, and NET Connection, etc., as for Report Designer Editor. According to
database connecting method used in documents, the dialog box of Database Connection
may be different. However, after connecting to database, the following process might be the
same mostly.

5.1.1. ADO Connection


ADO Connection allows you to retrieve data through OLE DB Provider.

To connect with OLD DB through ADO object, it is required to insert connection information
in Connection String. It is possible to type Connection String directly or use the following
Data Link Properties. If you click Create String, the dialog box will appear.

81

Chapter.1 Using Report Designer Editor

Provider

Show OLD DB provider list to be selected.

Connection

Input database name to be connected, user ID for log-on and password etc..

Advanced

Input network configuration and security level etc..

All

Input the other initializing properties.

ADO (ActiveX Data Object) is a new database connection entity of Microsoft Corp. It
makes various data types connect to database. Report Designer supports ADO entity as
OLE DB connection entity in order to access informal data, and various data sources.

5.1.2. RDAGENT Connection


RDAGENT Connection allows you to access data through Report Designer Server for
JAVA. See Report Designer Server for JAVA supplying with the server module for further
details.

82

5. Database

Enter the web path of Report Designer Server for JAVA into RDAgent Path. In case of
Runtime, you can set RDAgent path by selecting either /rf or /rfn of parameter options.

See Appendix III. Report Designer Parameters - III.1.27 for /rf, and III.1.31 for /rfn.
Enter RDAgent Path, User ID and Password, and then click Verify. Verifying successfully,
the service lists of registering in RDAgent appear in the Registered Service Names. Select
one of them and click OK to be connected.
Generally, it is impossible to fetch massive data at once due to the network condition. The
function of Use Part of Fetch is to use in fetching massive data partially according to the
number of queries you input into the number of queries handling for each fetch. However, it
is supported in Oracle DB only.

5.1.3. NET Connection


NET Connection allows you to access data through Report Designer Server for .NET. See
Report Designer Server for .NET supplied with the server module for further details.

83

Chapter.1 Using Report Designer Editor

Enter the server path of Report Designer Server for .NET into .NET Server and enter the
data source name to be connected into Data Source. Then click OK.
In case of Runtime, you can set connection server path by selecting either /rf or /rfn of
parameter options same as RDAgent Connection.

See Appendix III. Report Designer Parameters - III.1.27 for /rf, and III.1.31 for /rfn.

5.1.4. Confirm Connection


If a connection is successful after all the setups, the message of Connect to Database
Successful will appear. If an error occurs during DB connection, the message of Failed to
connect Database will appear. In this case, check the connection settings to ensure whether
all settings are correctly configured.

5.2. Define Query


After connecting to database successfully, you can write SQL statements. Select Database >
Define Query or click Define Query( ) on the Database toolbar, then the dialog box of
Define Query will appear as shown below.

84

5. Database

5.2.1. Selecting Query Type


In order to write SQL statements, select Query Type on the top of the dialog box of Define
Query. If it is not a sub page document, a Main Query can be selected only. In case of sub
page, the Main Query and Sub Query of the corresponding page can be selected.

Sub query is created in proportion to the number of sub pages. If you want to create
more than two sub queries, you have to insert Body pages as many as sub queries. You can
insert Body after selecting Edit> Edit Page> Add/Insert Body.

5.2.2. SQL Free Edit


Checking SQL Free Edit, you can directly input queries into the box as shown below. If the
SQL statements writing on SQL Free Edit comply with the SQL grammar of the current
report, all queries are available.

85

Chapter.1 Using Report Designer Editor

5.2.2.1. Open SQL/Save SQL


Open SQL is to open the SQL file saved and Save SQL is to save the SQL statement as an
external file.

5.2.2.2. View Records


When clicking View Records, you can view records which can be brought to the current
written queries. You can save the record data as the CSV file or the text file on clicking Save
as an external files.

The number of result records showing on View Records is limited to max. 10,000. In case of
bring Blod(Binary Large Object Data), such as image data and memo data in query
statement, it is not available.
If a query statement has parameter variables like $1 and $2, which transferred when a report
is running, View Records is not available.
However if parameter values are input through the dialog box of File > Enter Parameter
Values, you can review result records by operating query statement, which is replaced to the
parameter values in executing View Records automatically.

5.2.2.3. Verify SQL

86

5. Database

Verify SQL allows you to check whether a query statement is grammatically correct. This
is verified based on SQL grammar of the corresponding database so in case of using
the function, Query Dynamic Creation, you cannot verify.

5.2.2.4. Query Dynamic Creation


In case of using SQL Free Edit, it is possible to set whether a specific query line is added or
removed, therefore query statements can be created dynamically.
For example, /rp parameter option decides whether a specific query line is inserted or not,
based on a parameter with/without variables such as $1 or $2.

See Appendix III. Report Designer Parameters - III.1.53 for /rp.


In order to assign query line decided whether is inserted or not according to parameter
condition, it needs to be started with # or ^. The blank is not permitted.
The conditional clause between # and # means logical .and. among conditions, while the
conditional clause between ^ and ^ means logical .or. among conditions.
The conditional clause shows parameters variable effects according to their usage and
sequence. One means that a parameter is input in the corresponding order, 0 means that the
parameter is not input in the corresponding order. X means dont care whether a parameter
is input or not. For example, #1X0# means that the first parameter is input and the third
parameter is not input.
Let us suppose a maximum parameter and a minimum parameter is input from a specific
document. And you need to display data between the user defined maximum and the user
defined minimum. If you only input the maximum value, all the data lower than the maximum
value would be shown. If you only input the minimum value, all the data bigger than the
minimum value would be shown. If you dont input values of maximum and minimum, nothing
would be shown. Lets make a query statement to satisfy the above conditions. Query
Dynamic Creation makes it easier as shown below.

If you only input the first parameter, /rp [10] [], then the created query is as shown below.
SELECT person.name, person.age
FROM person
WHERE person.age >= 10
If you input the first parameter and the second parameter, /rp [10] [40] then the created

87

Chapter.1 Using Report Designer Editor

query is as shown below.


SELECT person.name, person.age
FROM person
WHERE person.age >= 10 && person.age <= 40
If string length is 0, it means no parameter.
When ## and ^^ are used in the same line, &(and) and/or |(or) are necessary. For
example ##&^^ means ## and(logical .and.). ^^ , ##|^^ means ##
or(logical .or.) ^^.

5.2.2.5. Using Main Query Field Name


Main Query Field Name or Parameter Variables make a dynamic query statement in the sub
query definition. In query statements, main query field names or parameter variables are
made as :(Customers.Name) or :($1) or :(). If a main query field is a data type, it is used
as :(Customers.Name).

5.2.3. Use Multi-DB


The function, Use Multi-DB is to bring data through the connected plural services in a
document (DB service connected by Report Designer Server). This function is only
available in both RDAGENT Connection and NET Connection. This function allows users
to bring data from different DB connection in a document.
In order to use Use Multi-DB, after selecting several DB services in the dialog box of
Database Connection, connect to them. Then check Use Multi-D, select the DB service
you want use on Service Name list.

5.2.4. Use Stored Procedures


This function can be used to bring the data by calling Stored Procedure of database and you
can define the calling stored procedure and passing parameter values.
Check Use Stored Procedure, the dialog box of Define Query will be changed as shown
below.

88

5. Database

In the Stored Procedures list box, stored procedures of the current connected database is
listed. If you want to select one of stored procedures that you want, double click the Stored
Procedures. Or click Select after choosing one of Stored Procedures in the list.
If the selected stored procedures needs parameters, input values into Set edit box after
selecting parameters in Set Parameters. In case of no parameter, check NULL.
If parameter options of /rp or /rv are input in Set Parameters edit box, parameters will be
passed when a report is running.

See Appendix III. Report Designer Parameters - III.1.53 for /rp, and III.1.104 for /rv.

Search

It is possible to search Stored Procedures that you want from the list by its name. It is not
case-sensitive. You can search even by partial strings. You can also use wildcard(*) at the
end/start of string to search a certain string.

89

Chapter.1 Using Report Designer Editor

Initialize

If you click Initialize, the selected Stored Procedures is released and the input box of
parameter values is initialized.

5.2.5. Result Record Set


It allows to bring only the records resulted from queries as many as the number of result
records from the top (TopN) or from the bottom (BottomN) as you specify.

For example, setting Result Record Set as TopN/10 Records, top 10 of query result records
is brought.

5.2.6. Use EJB Functions


Use EJB Functions is only available in RDAGENT Connection. When Use EJB Functions
is checked, the dialog box of Define Query is changed as shown below.

90

5. Database

EJB tab shows EJB list of the current connected database. Select one from EJB list, and
double click it or click Add, then it is added to Selected EJB. In EJB Method tab, methods
of the selected EJB tab are listed. Select a desired method.
The selected method is shown in Selected Method box. If parameters passing to method
are required, input values to be passed into Set values box after selecting parameters in Set
Parameters box. The usage of buttons in EJB list is similar to Stored Procedures tab. See
Chapter. 5.2.4. Use Store Procedures.

5.2.7. Use Query Caching


Use Query Caching is available in RDAGENT connection only. Query Cashing saves the
result of queries into a specific directory of a server and it allows to bring a cached file
without connecting to database.
Caching interval can be set through the Cache Timeout, after checking the Use Query
Caching.

5.2.8. Use Prepared Statement


Use Prepared Statement is only available in RDAGENT Connection and Oracle DB.
It makes the execution of query statements faster because parsing query statements are
needed just once.

5.2.9. Get Field Meta-Information by Execution Query

91

Chapter.1 Using Report Designer Editor

If you input a comment into Select clause or if you declare aliasing instead of as, normally it
is impossible to bring the Field List on Database > Map Dataset. In this case, you can
directly bring a field list by using the function of Get Field Meta-Information by Execution
Query.

5.2.10. Reuse Query Result


It is possible to reuse Query Result Data of a specific sub page on a different sub page.
Check Reuse Query Result on the sub page with Query Result Data and select the
checked Query Result Data in Reuse Query Statement combo box.

It is not necessary to edit Query separately on the sub page where query result will be
reused.

5.2.11. Use Sub Report


Use Sub Report makes the document saved as a separate file to be included in a different
document as to have Master - Detail structure as well as Master - Detail - DetailDetail
structure.
Checking Use Sub Report makes Define Query dialog box changed as shown below.

92

5. Database

In Sub Report File, define Form File to be included in a sub report. As Form file path,
absolute path and relative path based on the path of Form file including sub report are
supported. In Parameter Definition, define report parameters to be required in the sub
report execution. If main query field value or parameter variable values is required as a
parameter, put them between %RDS and %RDE.

5.2.12. Use Web Services


Use Web Services is available only in RDAGENT connection. Checking Use Web
Services makes Define Query dialog box changed as shown below.

Web Service List tab shows web service list of the current connected database. After
selecting a desired web service, double-clicking or clicking Add adds the web service to
selected web service list. In Web Service Method List tab, the method of selected web
service is listed.
The selected method is shown in Select Method box. If parameters passing to method are
necessary, input the value to be passed into Set Values box after selecting parameters in
Set Parameters box. The usage of buttons included in Web Service List tap is similar to
Stored Procedures tab. See Chapter 5.2.4. Use Store Procedure.

93

Chapter.1 Using Report Designer Editor

5.2.13. Using Making Query Statement Tab


This tab makes it easy to make query statement without using SQL Free Edit.

Table

It corresponds to the part of SQL From clause and allows selecting Table with data to be
printed.

Connected DB Tables list box shows Tables of the current connected database. After
selecting Table required in order to make SQL statement, click Add. Then the selected table
will move to Selected Tables.

Field

It corresponds to the part of SQL SELECT clause, allows selecting Table column to be used.

94

5. Database

Table Columns shows the selected table and the column of the selected table. After
selecting the column corresponding to the printed data, click Add.
Group Function is to group the column values of SELECT clause when GROUP BY clause
is used in query. At first after selecting one column of Table Columns list box, select one of
GROUP Functions and click Add. When Group function Variable name dialog box will
appear, input Alias name of the column applied with group function and then click OK.

Condition

It corresponds to SQL WHERE clause, allows making conditions between fields/columns.


Input conditions required in query into Edit box of the dialog box. If you double click the
name of column of Selected Columns, it will go into the Edit box. An operator also can be
input into the Edit box by clicking. To input conditions directly in the Edit box is possible.

Sort

It corresponds to SQL ORDER BY clause, allows sorting records to be printed with the basis
of a specific record in ascending order or in descending order.

95

Chapter.1 Using Report Designer Editor

After selecting the column to be used in Selected Columns, choose ASC or DESC. And
click Add, then the selected column is added to Sort Columns. After sorting records,
resorting is possible by selecting ASC or DESC again.

Group

It corresponds to SQL GROUP BY clause, allows selecting a basic column when grouping
the value of the different column is required.

After selecting the column to be used in Selected Columns, click Add. Then the selected
column is added to Group Columns.

Group Condition

It corresponds to SQL HAVING clause, allows inputting the grouping condition. To make the
grouping condition is the same as Condition tab.

96

5. Database

SQL View

It shows the completed query, allows editing query directly.

Clicking View Records, you can view the record brought by the current edited query. (See
Chapter 5.2.2.2 View Records.) If you click Verify SQL, it is verified whether the query is
correct grammatically. (See Chapter 5.2.2.3 Verify SQL.)

5.3. Define Field Query


When the result record is fetched with executing query statement assigned in Define Query
dialog box, there are many case, which dose not bring all data values you want to one query.
In this case, other different query statements can be made with the value brought from main
query or sub query in order to output the value as required. It is Field Query.
Select Database > Define Field Query or click Define Field Query ( ) on the Database
toolbar, then Field Query Definition dialog box opens. After clicking Add, input Field Query

97

Chapter.1 Using Report Designer Editor

Name, which will be used in a report.

Generally, you can SELECT only one field in field query. When you want to refer to
parameter values or main query field in WHERE clause, you need to follow specific syntaxes,
such as :(main query field name) or ($1). In case of referring to sub query field name, you
can use the same syntax, :(sub query field name). If main query data has character type,
then input as :(main query field name).
If some fields are used in SELECT clause of field query, add # to field query name. For
example, if you input personal information # into field query name, you can edit query
statements, as SELECT A, B, C, From T. In this case, A column has personal information 1,
B column has personal information 2 and C column has personal information 3. And you can
input directly the field query name in field name of Map Dataset dialog box, adopt it to an
object, and use it at editing summary.
In addition, in SELECT clause of main query statements or sub page query statements, you
cannot use general field and Blob field at the same time so use field query. You can get only
general field in SELECT Clause of main query statements or sub page query statements and
get Blob field separately by filed query. In case of using # symbol in field query name to get
multiple fields in SELECT clause, you should use general field and you cannot use Blob field.

98

5. Database

See Chapter 5.2.3 Use Multi-DB for Multi-DB Service Name and see also Chapter 5. 2. 8
Use Prepared Statement for Use Prepared Statement.

In case of using Report Designer Server (JAVA or .Net), you can use Query Field in
order to Blob field (image or memo data).

5.4. Disconnect Database


Select Database > Disconnect Database or click Disconnect Database on the Database
toolbar. Disconnecting database normally, the message of Database Disconnected. will
appear as shown below.

5.5. Set XML Schema


In order to set schema file which defined the XML document structure in XMLFILE
Connection Document, select Database > Set XML Schema or click Set XML Schema on
the Database toolbar, then Set XML Schema dialog box will appear as shown below.

Generally, Schema File checks the validity of XML document. In Report Designer 5.0, you
can use schema files to get the information of the XML document structure.

5.5.1. Setting Schema Type


Set the type of using schema. You can select one of XDR Schema file, DTD file, and XML
Sample Document as a schema type.

99

Chapter.1 Using Report Designer Editor

5.5.1.1. XDR Schema File


XML-Data Reduced (XDR) language supported by MSXML parser.
The following is its declaration part.
<Schema name=fooSchema xmlns=urn:schemas-microsoft-com:xml-data
xmlns:dt=urn:schemas-microsoft-com:datatypes>

The following is the example of XDR schema file. (authors-schema.xml)


<Schema name=authors xmlns=urn:schemas-microsoft-com:xml-data
xmlns:dt=urn:schemas-microsoft-com:datatypes>
<ElementType name=name/>
<ElementType name=nationality/>
<ElementType name=authors content=eltOnly model=closed>
<element type=author maxOccurs=*/>
</ElementType>
<ElementType name=author model=closed content=eltOnly >
<element type=name/>
<element type=nationality/>
</ElementType>
</Schema>

5.5.1.2. DTD file


DTD stands for XML Document Type Definition(DTD). Report Designer 5.0 supports
partially DTD. The DTD specification is as shown below.
Element declaration: In case of not using an entity, it is supported
Property declaration: in case of not using an entity and @type property, it is supported)
The following is a DTD example.(authors.dtd)
<!ELEMENT authors (author*)>
<!ELEMENT author (name, nationality)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT nationality (#PCDATA)>
If not supported element declaration is included in a DTD file, Set Schema File will not
operate,

5.5.1.3. XML Sample Document

100

5. Database

Report Designer 5.0 brings XML document structure through XDR schema file, DTD file,
and XML sample document.

5.5.2. Setting Schema File


Set the absolute path of XDR schema file, DTD file, or XML sample. If a schema file is set,
all elements of the selected schema will be added to root element combo box.
If the selected schema file is not supported, the following error message will appear.

In case of XML sample document, it cannot recognize #PCDATA Content type elements and
Repeat element automatically. When XML sample file is selected as a schema file, you
should set #PCDATA Content type elements and Repeat element on dialog box as shown
below.

Setting Image Element

In case of XML sample document, a specified element encoded in BASE64 type is printed

101

Chapter.1 Using Report Designer Editor

as an image. When the field is set with selecting Database > Connect File after the
corresponding element is defined as the image element, you have to select the field type of
the element as LONGVARBINARY.

5.5.3. Setting Root Element


Select the top root element of the elements list defined in the selected schema file. The
selected root element is the top element value of the main query. If you open Define XML
Query dialog box, you can confirm that the root element is defined as the root element of the
main query.

5.6. Define XML Query


Define XML Query means defining XSLT Style Sheet in order to fetch data from XML
document. In this dialog box, Define Field tab, Define Condition tab, Define Sort/ETC tab,
and Show XSLT tab are provided to make it easy to define XML query.

5.6.1. Compare SQL Query Definition with XML Query Definition

Data Access Method

In order to access data of relational database(RDB), Table Name. Column Name is used as
shown below.
SELECT Employees.EmployeeID, Employees.FirstName, Employees.HomePhone
FROM Employees

102

5. Database

However in order to access data of XML document, XPath (XML Path language) is
necessary. XPath has tree structure, similar to the directory/file structure of the file system.
Refer to following examples.
authors/author/name XPath to access name element of child author element of authors
element.
authors/author[nationality='Russian']/name - XPath to access names of people whose
nationality is Russian on author element.

Query Definition Result

When SQL query definition is completed, SQL query is created. On the contrary, if XML
query definition is completed, XSLT style sheet will be created. Both are used to fetch data
from data source during creating report.

5.6.2. Query Name and Root Element

Query Name

Select Main Query or Sub Query as query definition.

Root Element

When you set XPath path for fetching data from XML document, you should set the Root
Element of the selected element earlier. The selected element is set as the relative XPath of
the Root Element. At the moment, the Root Element of main query is root element, the Root
Element of sub query is repeat element. A Root Element already used cannot be used again.

Selecting Root Element

Root element set in Set XML Schema is selected as the Root Element in main query and
cannot be modified.
Root Element of sub query can be selected among Root Element combo box. List of element
is XPath of element which can be repeated in XML document, thus if there is no repeat
element in document structure, sub query cannot be used

Root Element XPath and Selected Element XPath

Root Elements are a root element of the query XML document structure tree. XPath of
selected element is a relative path of Root Element. So if XPath of Root Element is
/authors, and XPath of selection element is /author/name then XPath of Root Element is
/authors/author/name.
An xsl:template is created for each query (main/sub) in XSLT Style-Sheet, and Root
Elements are used as a match to property value of xsl:template element.
There are xsl:template in XSLT documents created by XML query definition. Root Elements

103

Chapter.1 Using Report Designer Editor

match property value of this element. For example, if Root Element of main query is
/authors then XSLT Style-sheet is created as shown below.
<xsl:template match=/authors>
</xsl:template>

5.6.3. Define Field


Set XPath of data for fetching from XML Document.
Double click selection element from XML Document structure tree on left dialog box, or click
Add. Then relative XPath and Alias of Root Element of selected element is inputted. Here,
) and property element (
) are allowed to be added.
mixed type element (

XML Document structure tree

It shows XML Document structure tree taking Root Element as root element. In order to
extract the data from XML Document, add node into select field list.

Selected Field List

Set XPath of data you wish to fetch from XML Document.

Selection Element(XPath )

Selection element is XPath of Data to be extracted from XML document. You can access
Data in XML Document either with XPath of top most elements or XPath of selection
element.

104

5. Database

Alias

You can modify alias of selection element after clicking Alias section. Alias is another name
for selection element used as Data connection set. Alias does not allow using the repetition
of the same name.

Changing the order of selection elements

When you add element into selection field list, it is added as the last element. If you want to
change the location of element, use
button

Adding/Deleting element

button it inserts currently selected element of XML document structure


When you click
button, then it inserts all elements of XML
tree in selection field list. When you click
button it deletes currently
document structure tree in selection field list. When you click
selected element in XML document structure tree. When you click
button, then it
deletes all elements in selection field list.

5.6.4. Define Condition


Input the condition of data extraction. If condition clause is input in main query or sub query,
then data corresponding to the condition will be extracted from XML Document.

Enter Conditions

Input a condition applying to query. You can use parameter variable ($variable) on
conditional clause. In order to use string constants in conditional clause, you need to use
single quotation mark ()

105

Chapter.1 Using Report Designer Editor

name=Smith
../@type='$1'

Element List

Element name and property name is listed in Element list. Double click element to insert into
input condition section.

Operator, Reserved Word, Axes and Node Test and Function List

This is function list of reserved word that can be used in condition clause. Double click
element to insert it into input condition section. For more details, refer to XSL specification
(related site - http://www.w3c.org)

Caution

Input XPath as relative path when element name and property name are used in conditional
clause. Basis element of relative path is different on main query and sub query. When you
input into main query then repeated elements are the basis element. In case of sub query,
Root Element is the basis element. Input relative path to extract data normally.
If repeated element of main query is data/region and name element into conditional clause is
added, then it becomes data/region/name.
If the top most element of sub query is /sales/data/region/quarter, and adding @number
element into conditional clause then, @number is relative path of /sales/data/region/quarter,
resulting in /sales/data/region/quarter/@number .
When you check XSLT after inserting conditional clause, then it should be as shown below
<xsl:template match=Root Element of Main query>
<xsl:for-each select=Repeat element of Main query>
<xsl:if select=[Condition Clause]>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match=Top most element of sub query [Condition clause]>
</xsl:template>

5.6.5. Define Sort/ETC

106

5. Database

When you set align field then you can extract aligned Data. You can set align order
(ascending/descending) and element type(character/number). You can also set the number
of records to extract like all elements, higher N, and lower N

Selection Element

If you set checkbox then aligned data is extracted based on the field name. Set Off on the
checkbox to cancel align.

Alignment Order

Set ascending/descending.

Element Type

Set as character or numeric.

Changing Location

When you set several field names as align option then higher field name takes priority. To
change the priority of the element, use
button.

Set number of records to fetch

This set the total number of records to fetch. When you set All, fetch all elements
corresponding to condition. If you set higher element N then it extract Higher N and if you set
Lower element N then it extract Lower N.

107

Chapter.1 Using Report Designer Editor

5.6.6. Show XSLT


This shows XSL Style sheet created finally on Define XML Query.

XSLT Style sheet is XML File consisted of several xsl:template element. For more details on
XSLT refer to the site - http://www.w3c.org)

Free Edit XSLT

If you check Free Edit XSLT, Define XML Query dialog box provides Wizard method for
you. It allows you to update a created XSLT style sheet with easy.

Bring field list by applying XSLT

This option can be used if you do not want to use field list created automatically in Free Edit
XSLT. You can newly create field list with adopting modified XSLT.

Create New XSLT

In Define XML Query dialog box, this option allows you to create XSLT style sheet by using
Define Field tab, Define Condition tab, and Define Sort/ETC tab as Wizard method.

Features

Define XML Query for main query and every sub query is to be one xsl:template element
and the Root Element are to be matching element of style sheet template.

5.6.7. View Result Records

108

5. Database

This function shows data record in XML applied to XSLT. Click View Records in XSLT View
tab.

XML File

In order to watch record, select XML file.

Execute

Execute record fetch to Fetch Data with applying Style-sheet to XMLData.

Result Records

This shows Result record fetched from XML document as table type. In case sub query is
used, data is displayed as main query, sub query1, sub query2, and the title are the main
query title.

In case of using the $ variable in condition define, execute watch record after
substituting $ variable into real value.

5.6.8. Show Created XSLT


This sample shows XSLT style sheet which extracts data from sales.xml File.
1 <?xml version=1.0 encoding=UTF-16?>
2 <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform>

109

Chapter.1 Using Report Designer Editor

3 <xsl:template match=/>
4 <xsl:element name=recordset>
5 <xsl:apply-templates select=sales />
6 </xsl:element>
7 </xsl:template>
8 <xsl:template match=/sales>
9 <xsl:variable name=heading select=summary/heading />
10 <xsl:variable name=subhead select=summary/subhead />
11 <xsl:variable name=description select=summary/description />
12 <xsl:variable name=countVal select=count(data/region) />
13 <xsl:for-each select=data/region>
14 <xsl:sort select=name order=descending data-type=text />
15 <xsl:element name=mainrecord>
16 <xsl:if test=position() &lt;= 2>
17 <xsl:element name=record>
18 <xsl:property name=name>
19 <xsl:value-of select=name />
20 </xsl:property>
21 <xsl:property name=heading>
22 <xsl:value-of select=$heading />
23 </xsl:property>
24 <xsl:property name=subhead>
25 <xsl:value-of select=$subhead />
26 </xsl:property>
27 <xsl:property name=description>
28 <xsl:value-of select=$description />
29 </xsl:property>
30 </xsl:element>
31 <xsl:element name=subrecord>
32 <xsl:apply-templates select=quarter>
33 <xsl:sort select=@number order=descending data-type=text />
34 <xsl:with-param name=vname1 select=count(quarter) />
35 </xsl:apply-templates>
36 </xsl:element>
37 </xsl:if>
38 </xsl:element>
39 </xsl:for-each>
40 </xsl:template>
41 <xsl:template match=/sales/data/region/quarter>

110

5. Database

42 <xsl:param name=vname1 />


43 <xsl:element name=record>
44 <xsl:property name=books_sold>
45 <xsl:value-of select=@books_sold />
46 </xsl:property>
47 <xsl:property name=number>
48 <xsl:value-of select=@number />
49 </xsl:property>
50 </xsl:element>
51 </xsl:template>
52 </xsl:stylesheet>
Line 1 is document declaration section. XSLT style sheet is also an example of XML
Document.
Line 2 is style-sheet name space declaration section.
Line 3-7 is basic template.
In line 5, sales are root element.
Lines 8-40 are Main query template.
In Line 8, /sales is Root Element of the main query.
In Line 13, data/region is repeated element of main query.
Line 14 indicates sort with name element. (Sort definition : Whole XPath of sort element
is /sales/data/region/name).
Line 16 means bring only upper 2 records. (The total number of data to fetch)
Elements in XML document to fetch from main query are name, heading, subhead,
description. (Field definition)
Line 33 means sort sub query with @number element. (Whole XPath of sorting element
is /sales/data/region/quarter/name.)
Lines 41-51 are template of sub query (1 page).
In Line 41, /sales/data/region/quarter is the Root Element of sub query.
Element in XML document fetched by sub query is books_sold, number. (Field
definition)

5.7. Connect File


In case the type of database connection is File Connection or XML Connection, you can
set the location of the file to be used in a document or Number of Column, Field delimiter,
and Field Type include in the file by selecting Database > Connect File or clicking Connect
File( ) on the Database toolbar.
File Connection in File Connection Document is the same as the function to combine
Query Definition Function with Connect Database Function.

111

Chapter.1 Using Report Designer Editor

5.7.1. File Connection tab


It allows defining the location of the file to be used, the way of connection. There are four
ways in file connection, No Server, Use MI Server, Use FTP Server, and Use HTTP Server.

5.7.1.1. No Server

In case of connecting to a file located in client, not using a server, it is useful. File Search
button allows searching the file to be used. To input the file path is possible. The relative file
path on the form file is effective.

5.7.1.2. Use MI Server

112

5. Database

Use MI Server is an option connecting to the server located data files through Middleware,
which is Server Module for UNIX. To use this option, Server IP is necessay.
If MI server is not installed on the data file server, it does not operate. So, it is required to
purchase it separately.

5.7.1.3. Use FTP Server

Use FTP Server is an option connecting to data file of the FTP server. To use this option,
Server IP, User ID, and Password are necessary.

5.7.1.4. Use HTTP Server

113

Chapter.1 Using Report Designer Editor

Use HTTP Server is an option connecting to data file using server through URL. It allows
using CGI, Servlet, ASP, JSP that are extracting data from database, as well as text file.
However, in case of using Servlet or JSP, their printout form has to be the printout form
supported by Report Designer

5.7.2. Field Definition tab


Selecting Field Definition tab from Database > Connect File dialog box allows defining
field in data file.

First, select type of field from the top of Field Definition dialog box. In case not a sub
page, you can write Default Field Definition. If it is a sub page, you can define default field
and sub page field of each page.

5.7.2.1. Number of Column


The number of Column defined in the field means the number of connected data file
fields. If it is too large, error will occur. If it is too small the rest of the field will be ignored
Type of default field is CHAR, its length is 64. Both can be modified.

Generally, one column means on e record in data file. However, in case of data
including entity value, field type should be set as VARCHAR.

5.7.2.2. Use Text & Field delimiter


When Use Text is checked, data can be fetching from data file. When it is not checked,

114

5. Database

data can be fetched from binary file.


In case of text file, Field delimiter divides each field. In case of a binary file, each field is
divided by its length. Binary file is based on ODBC Data Type.
You can use field delimiter in case of checking Use Text. If delimiter is not selected, then
fields are divided by its length.

When a chart is showing in file connection document, type of field of with values
displayed on chart should be of Numeral (NUMERIC, INTERGER and Etc).

5.7.2.3. Defining Field

Delete

It deletes selected file in Define Field List.

Modify

In order to change Define Field Set as default value, double click or select the column and
click modify. Then you can input the desired value.

Insert/Add

Insert/ Add Field Definition with default value onto the upper or lower of selected field in
Define Field list.

5.7.2.4. Save as File


Save the contents of field definition as an external File. It is saved as text file and you can
also use the file in a different page.

5.7.2.5. Get Definition


Open the contents of field definition saved in text file type. Even if it was not saved by Field
Definition > Save as File, any file can be opened as long as it is a text file and has a type of
Field Definition.

5.7.2.6. Reuse result record


This option allows you to reuse Result Record of a specific subpage of Subpage Report in
other subpage. Check Reuse result record in a subpage using result record. And in other
subpages Field Definition, select Subpage Field Definition that Reuse result record was
checked.

115

Chapter.1 Using Report Designer Editor

5.7.3. Using Connect XML File dialog box


In XML File connection document, selecting Database > Connect File opens Connect XML
File dialog box, as shown below. XML document file has to be selected. To use this dialog is
the same as text file connection

Compare Text File Connection with XML File Connection

In case of Text File Connection, in order to perform Field Define, a location of a text file
with data is assigned. In case of XML File Connection, in order to perform Field Define, a
location of an XML file with data is assigned.
The field defined in XML Query Definition is added automatically to Field List of Field
Definition tab. XML Query Definition dialog box allows deletion, modification, insertion and
addition of a field,

116

5. Database

5.8. Map Dataset


Regradless Connect Database method, after completing Connect Database and Define
Query or Connect File, Map Dataset allows connecting data to TextFrame or each table cell.
Selecting Database > Map Dataset or clicking Map Dataset(
opens Map Dataset dialog box as shown below.

) on the Database toolbar,

After selecting on a table cell or a Text Frame object for field insertion, select a Field Name
from the Field List in Dataset connection dialog box, and click Apply. The field will be
connected the Object. As the follwing picture, dim text shows it is connected.
If you want to modify or delete the connected, after opening connect to dataset dialog box,
select the object. Contents of Field name can be modified or deleted as you want.

If you selected two or more table cells and then selected the same number of fields in field

117

Chapter.1 Using Report Designer Editor

list, clicking Apply will put each selected fields into each blocked table cell on the order of
field list.
Map Dataset dialog box has four tabs such as Assign Variable, Prepare Summary,
Reference Field and Summary Condition.

5.8.1. Assign Variable tab


It is the basic function of Map Dataset . Its function is to connect field or variable to Object or
Table. There are five options, Merge Cells, Merge All, Merge Adjacent Cells, Write Once
and Summary.

Field Name

It shows a field name connected to an object when the object is selected with Map Dataset.
If you want to apply a specific parameter(/rp or /rv parameter variable name) which is not in
Field List, it is possible to input it directly.

See Appendix III. Report Designer Parameters - III.1.53 for /rp, and III.1.104 for /rv.

Field List

It shows Field names defined in Query Definition and Field Query Definition or Field
Definition of file connection.

Write Once

When adjacent cells have the same data on a same column, it makes data only in the first
cell to be shown. It is available in reputation clause and summary clause.

118

5. Database

Merge Cells

As Write Once, it makes all adjacent cells on a same column which has the same data to be
merged into one cell has the same data. It is available in repetition clause and summary
clause. Reference Field tab will be available.

Merge All

Checking Merge Cells makes it active. After Merge Cells, if next adjacent cells on the same
column are blank, it will merge adjacent next blank cells into Merged Cells.

Merge Adjacent Cells

When adjacent cells have the same data on a same row, cells can be merged into one cell
has the same data. This option has to be set on each column.

Summary

When summary clause is applied to Text Frame or Table Cell, Summary check out is
checked. If Summary is checked, Prepare Summary tab will be added to Map Dataset
dialog box.
When Calculation is applied by row, data property is applied according to the condition of
data, Prepare Summary tab is used,
For example. When new column amount multiplied price by quantity is inserted, when text
for value for amount has different color according to sales amount. Summary is used.

5.8.2. Reference Field tab


Checking Write Once or Merge Cells opens Reference Field tab. If you click Add after
selecting one field from Field List list box, it will become a reference field and it will be
added to Reference Field List, as shown below.

119

Chapter.1 Using Report Designer Editor

Reference Field is the field to be referred before checking Write Once or Merge Cells in a
record. Even if data of which a field is defined as Write Once or Merge Cells are
repetitiously same, if data of the reference field is different, Write Once or Merge Cells is
not applied. You can select several reference fields.

5.8.3. Prepare Summary tab


Prepare Summary tab is used when you need to apply calculation to data to be input with
operators, +,-,*,/. Also, the desired calculation can be input in use of various summary
functions provided from Prepare Summary.

120

5. Database

Summary Edit Box

Input calculation regarding the field value input with using simple calculation by +,-,*,/ , or
various summary functions.

Accumulate summary clause values

If cell of the selected table is repetition section, unconditionally summary values will be
accumulated. However it is summary section, Accumulate summary clause values check
box decides whether summary clause values are accumulated or not. If Accumulate
summary clause values check box is checked, Initializing condition of summary values
will be active.

Initializing condition of summary values

It initializes summary values according to conditions.


Only Once, On Every Page and According to Field are provided as conditions. According
to field value, conditions can select Field Name to be used. In case of date field, the
condition can be applied to Year, Month, or Day separately.

According to field values of Initializing condition of summary values, two or more field
names can be applied. At this time, field names are divided by colon(:), for example
Orders.CustomerID:Employees.EmployeeID. If at least one of the selected fields is
changed, the condition will become OR condition.

View final result only

This option is used only when cell of the selected table is Summary Section. Basically,
summary section has a property that prints value calculated by the edited calculation in
Preparing summary with specific condition
However, in case of balance sheet, it is not permitted to print the sum while its content is not
completed. In this case, you can use View final result only after completing internal
calculations, and value printed on the last page.

List of Summary Functions and Usage

In order to help to edit summary statements, all available function are shown, its usage is
displayed at the bottom. Copy copies the selected function from List of summary clause
function into Prepare Summary Edit box.

See Appendix I. Report Designer summary on detail summary functions.

5.8.4. Summary Condition tab

121

Chapter.1 Using Report Designer Editor

It sets printing conditions of summary section. Summary Condition tab opens only when
cell of the selected table is Summary Section.

According to Condition

It provides options such as insert to last page, or insert on each page, or insert each
repeated part, etc

According to Field

This condition makes summary section to be printed whenever values of specific fields
makes is changed. When the field list of field definition opens, select one from the field list.
In case of date field, it is possible to set Year, Month, or Day separately.
In order to set two or more fields, use colon (:).

According to User Defined

If a defined conditional clause is TRUE, summary section will be printed. The result of
printing conditions of summary section is always TRUE or FALSE. As soon as summary
section is printed, the condition is initialized. However, it can be used in CrossTab table
report.

Insert Before Repetition Section

Basically, summary section is inserted next to repetition section. However, this option is set,
summary section is printed before repetition section.

122

Insert Space after Summary

5. Database

For a better view of the report form, you can insert a blank line as many as you defined after
printing summary section

Insert Summary after Blanks

This can be applied when Draw Blanks check box is checked in Table > Set Table
Properties. When summary section is printed by summary print condition, summary section
will be printed after printing the blank if Draw Blanks is applied.

See Chapter 6.2 Set Table Properties on detail Draw Blanks.

5.9. Enter Conditions for Data Conversion


Enter Conditions for Data Conversion is used for converting data from a database into
other value according to specific conditions.
Selecting Database > Enter Conditions for Data Conversion or clicking Enter Conditions
for Data Conversion( ) on the Database toolbar opens Enter Conditions for Data
Conversion dialog box as shown below. After selecting table cell or TextFrame applying
Enter Conditions for Data Conversion, edit the replacement condtions with the dialog box.

Enter Conditions

Enter data conversion conditions.

Enter Values

Enter values to be applied when conditions are satisfied.

Enter Default Values

Input default values if conditions are not satisfied.

123

Chapter.1 Using Report Designer Editor

Field List & Field Query

Display currently available fields and field query names.

Add

After editing the replacement condition, if you click Add, the contents of edited replacement
condition will be inserted to below Replacement Condition Output box.

Modify

When you want to modify the replacement condition, select the replacement condition to be
modified. After changing Enter Conditions, Enter Values, Enter Default Values, if you click
Apply then the modification will be completed.

Delete / Delete All

Delete the selected replacement condition in Replacement Condition Output box. Delete all
replacement conditions.

5.10. Edit Script


Edit Script can be used only when Use Script is checked in New dialog box, even if Report
type is Fixed Form, General Form, Table Form, or Label Form.
Selecting Database > Edit Script or Clicking Edit Script(
opens Edit Script dialog box as shown below.

124

) on the Database toolbar

5. Database

5.10.1. Variable Name


Variable Name edit box is a location where a name (variable name) is given to a selected
object. Necessarily, after selecting an object in advance, the variable name of an object can
be input into Variable Name edit box. The variable name should be the one and only name in
the file. In case the variable name has been used already, an error message will appear.

5.10.2. Variable Type


Variable Type selection box is the location to set variable type to data to be printed through
the variable. There are four types, Char, Num, Date, Time. Every object has its variable
name. However only TextFrame and table cell have variable type.

5.10.3. Variable List


Variable List is the list box that has variable names of all objects using in the current Report.
If a variable name from Variable List is selected, you will move to the page that the object
has assigned the selected variable name. The object with the selected variable type has a
small rectangle on each corner. In case of table cell, it is inverted. At this time, the variable
name of the selected object is shown in Variable Name edit box, the variable type of the
selected object is shown in Variable Type selection box.

5.10.4. Script Edit Window


Script Edit Window is the location script is input/edited for printing a report.
Script Edit Window supports Copy (Ctrl+Ins, Ctrl+C), Cut (Ctrl+Del, Ctrl+X), Paste
(Shift+Ins, Ctrl+V) and Find/Replace(Ctrl+F) in order to edit a script easily.

5.10.5. Script Hint and Usage


It allows you to check explanation for various script functions provided in Report Designer.
See Appendix II Report Designer Script usage on all explanation for all script functions.

5.10.6. Refer to Script


Refer to Script is used for referring to script to be edited in other files. Checking Refer to

125

Chapter.1 Using Report Designer Editor

Script makes reference file list active and shows Reference Script window.

5.10.6.1. Reference File


Reference File list box is used for referring to scripts of other files regarding the current
report. If you select a file to be referred, the name of the selected file will appear in the list
box.

5.10.6.2. Reference Script


Reference Script windows show scripts described in the selected file of Reference File list
box.

5.10.7. Buttons

OK

OK button verifies script grammar as clicking Verify button and closes Script dialog box,
and then finally you can edit a report.

Cancel

Cancel returns script to the previous status. That is to say, if you edit script after opening
Script dialog box, the modified script will go back when Script dialog box opened. However
after script modified, if you had clicked Apply, OK, Cancel button cannot returns the script to
the previous status. And after modifying script and closing Script dialog box, even if you
open Script dialog box, Cancel button cannot returns the script to the previous status.

126

Apply

5. Database

Apply button applies the modified script to the current report. If you click Apply button, the
modified script will be saved and it can be returned by Cancel button.

Verify

Verify button grammatically verifies the script described in the current file. If the script has a
grammar mistake, it let you know where the mistake made.

Delete

Delete button deletes a variable name of the selected object. The variable name in Variable
List is also deleted.

Even if a variable name in Script dialog box is deleted, the object in Editor Window will
not be deleted.

Merge Cells

Merge Cells adjacent cells repetitiously have the same data on a same column, it makes
data only in the first cell to be shown without repetitiously showing data in all adjacent cells.
In order to apply Merge Cells, after select the cell in a report or the object variable name,
apply Merge Cells.

Merge Adjacent Cells

Merge Adjacent Cells adjacent cells have repetitiously same data on a same row, cells can
be merged into one cell with the data. This option has to be set on each column. Merge
Adjacent Cells merges cells when horizontally adjacent cells by a column applied the
repeating option have the same content. Merge Adjacent Cells should be applied to all two
cells.

Write Once

Write Once adjacent cells have the same data on a same column, Write Once makes data
only in the first cell to be shown without repetitiously showing data in all adjacent cells.

Merging Cells and Write Once can be used when the repeating option is assigned to
the table.

5.10.8. Pop-up menu on Script Edit Window


Pop-up menu appears when you right-click a mouse in script edit window as shown below

127

Chapter.1 Using Report Designer Editor

Save as File

Save as File saves a described script as a script file or text file.

Open From File

Open From File opens saved a script file or a text file edited from a text editor programs.

Find/Replace String

Find/Replace String finds or replaces certain string in saved script file or text file edited
from a text editor.

Even if you press Ctrl + F, while editing a script, same Find/Replace dialog box will appear.
If you check Find whole words only, you can find the word consisting of the inputting
character string. And if you check Case Sensitive, you can find the character string which is
consisted of letters and capitals exactly as you inputted.
The search will start from the location where the cursor is blinking in the current Edit window.
When the cursor moves to the end of the document, Find process will start again.

Zoom In

Zoom In menu zooms in the size of script edit window in script dialog box as much as
possible. When you use this function, it separates from the section and shows the part of
variable name and script edit window. When you want to return to original Script dialog box,
click Zoom In menu once more on Pop-up menu after clicking the mouse left button on
Script window.

5.11. View Records


128

5. Database

View Records is used for viewing the database value directly. Selecting Database > View
Records or clicking View Records( ) on the Database toolbar opens Record View dialog box.

In order to use View Records, the database to be viewed records is connected. After
opening View Records dialog box, if you select the desired table from Table combo box, the
corresponding field name and result records are shown.

View Records

After selecting one more field name, if you click View Records, result records of the selected
field can be viewed.
When there are too many results, you can filter result records by entering conditions at
Condition edit box (Where clause). The condition is edited with including Where.

Save File

Save File is to Save the result records as an Excel(*.csv) or a Text File(*.txt).


When a file is save as a Text file , if you input a delimiter into Set Delimiter, the delimiter will
be inserted between fields. The text file can be used as a data file in file conection.

129

Chapter.1 Using Report Designer Editor

5.12. Define Data Division for SubPages


The previous main query-sub query structure had a week point to make the query
processing time longer because sub query was processed repetitiously as many as the
number of main queries. However if only the field value of main query is input into the
condition clause of sub query, Define Data Division for SubPages will allow you to draw a
report after dividing the result of one sub query processing on the basis of the field value of
main query.
If selecting Database> Define Data Division for SubPages, the below dialog box may be
displayed.

In the dialog box, select the sub page to be applied Define Data Division for SubPages.
And then click Add after selecting the field value of main query to be divided as the condition
clause.
The sub page data need to be sorted by the sub query field name compared to the main
query field value. If the comparing field name is more then two, the order of the selected
main querys field name have to accord with the order of the field name to be used in sub
querys conditional clause.
For example, when you draw a report with referring to Employees.EmployeeID which is a
main query field in sub query, you have to insert main query field name into WHERE clause.
However Using Set sub page data , you need to insert only Employees.EmployeeID value
to be referred in the page into Set Sub Page data dialog box after editing WHERE clause
and ORDER BY clause as shown below. It makes the sub query to be processed just once
and makes the total query processing time shorter.

130

5. Database

5.13. Set Pre/Post Process


This function can be used when connection directly to ORACLE, or connecting using the
Middleware. After registering the PL/SQL block of ORACLE, you can execute either in the
begninning of a reporting or in the end of it. The Pre-Processing sets PL/SQL block to be
executed before the start of reporting, while the Post-Processing sets PL/SQL Block to be
used after the end of reporting. The result values from executing the Pre-Processing can be
used in the query statement used within the reporting.
Selecting Database > Set Pre/Post Process or clicking Set Pre/Post Process(
Database toolbar opens Set Pre/Post Process dialog box.

) on the

Before creating PL/SQL Block, Pre Processor or Post Processor has to be selected. Add
button adds Host Variables using in PL/SQL Block. If you double click Variable Name or
Length, both can be changed directly. Variable type is limited to CHAR type.

131

You might also like