Title: Create aX report with crystalreports
1Create aX report with crystal-reports
How to create a report by using an automationX
spreadsheet How to create a crystal-report
manually
2Create a report by using an automationX
spreadsheet
- Setup automationX-spreadsheet
- AutomationX Report Designer
- Setup data-source connection of Crystal-Report
- Create crystal-report file and definition files
- Report Design
- Print automationX-spreadsheet report
- Troubleshooting
3Create manually a Crystal-Report
- Basic Study
- Starting with Crystal-Report Wizard
- Create a Data Definition File
- Finishing with Crystal-Report Wizard
- How to use axcrprint.exe
4Setup AutomationX-Spreadsheet
- Insert a SpreadSheet from the Automation Core
Classes - Setup the instance name
- Column-Labels enter a clear text into the used
column-labels
The column-labels are the column-header in the
crystal-report.
For further informations about editing
spreadsheets have a look at the system manual
4.0, 8.6.6.
5AutomationX Report Designer Task 1
Create the report by using the automationX-report
designer. This designer works in offline-mode
and is used to create the main-part of the whole
report-files. Push the right mouse button to
open the spreadsheet popup. Select Define
Report to start the automationX-report designer.
Read these instructions very carefully!!
Edit aX-DB is for single automationX variables
which are embedded into a crystal-report.
6AutomationX Report Designer Task 2
- Define a Report-Name
- Locate the crw32.exe Use the search dialog to
find out the position.
If a printer-name has been registered, it is not
possible to change him in run-time. If no
printer-name has been registered, the reports
will be printed on the system-standard printer.
- Printer setup Popup with current on system
installed printers. Select a defined printer
and push OK for accept selection. Push cancel to
abort printer-selection.
7AutomationX Report Designer Task 3
- Go back to the windows-popup with the
instructions and click on the button Create
default report to start Crystal Reports. - On this procedure automationX creates following
files - ax_database.ttx data-source with aX variables
the variables (now strings!) must be inserted
manually - ax_table.ttx data-source with the table-data of
the spreadsheets - config.txt configuration-file from automationX.
8Setup data-source connection of Crystal-Report
Task 4
- Start the crystal-report data-explorer of
axdefault.rpt - Database gt Add Database to Report
- 2. Select type of data source in the
data-explorer - More Data Sources\Active Data\Active
Data (Field Definitions Only) - Add your specific data-source connections
- ?ax_table.ttx (spreadsheet data definitions)
- ?ax_database.ttx ( server variable definitions)
- ?ax_repvis.ttx (visual variable definitions)
- Browse in your report directory for the specified
ttx-file
9Setup data-source connection of Crystal-Report
Task 5
- Select the file and click Open to append this
file to your data-source collection. Push
Cancel to abort selection. - The following picture shows the data-explorer
after binding the .ttxfiles for a spreadsheet
and server-variables. - Click onAdd to append the specified
data-source to the report-datasources. - After appending all data-sources exit
Data-Explorer.
A datasource could only be used, if it has been
added to the report data-sources. All available
data-sources are shown in the FIELD-EXPLORER in
Crystal-Report.
f) Save the report file File --gt
Save g) Accept default report and create
spreadsheet-report Push OK in the AX-Report
popup
EXIT Data Explorer
10Setup data-source connection of Crystal-Report
Task 6
- After selecting ok, the automationX Report
Designer creates the reportfile, which is used by
the project. - The designer automatically inserts the
- definitions for the spreadsheet into the
ax-table.ttx .
- Open the project report-file testreport.rpt and
verify the database. Now the spreadsheet fields
are available in the report. - h) The last task for you is to insert the
data-fields into the report. For this open the
field explorer. Insert the specified fields into
the report by dragdrop.
11Report Design Task 7
- Every report consists of
- Report header
- Side header
- Detail range
- Side footer
- Report footer
Header Detail Footer
If you want to insert fields of server- or visual
variables, put them into the report-header or
report-footer.
12Create a Crystal-Report File Definition Files
Task 1
Do you bind data except spreadsheet-data?
DO YOU WANT TO ADD DATA EXCEPT THE
SPREADSHEET-DATA?
NO
YES
Necessary Data Definition Files
- ax_table.ttx spreadsheet data
- ax_table.ttx spreadsheet data
- ax_database.ttx server data
- ?open with edit ax-db edit
- ax_repvis.ttx visual data
- ?open manually with a text-editor edit
13Create a Crystal-Report File Definition Files
Task 2
- Variable- and Typedeclaration of
SERVER-VARIABLES - A STRING has a minimum length of 50 character
(default). - If you define in automationX a length of 150, you
have to set the string length of the variable to
150 in the definition-file. - Other data-types The data-types will be casted.
So you have to use following string lengths to
avoid any errors.
- Variable- and Type declaration of
CLIENT-VARIABLES - A STRING has a minimum length of 50 character
(default). - If you define in automationX a length
of 150, you have to set the string
length of the variable to 150 in the
definition-file. - Other data-types The data-types will be casted.
So you have to use the following string lengths
to avoid any errors.
14Create a Crystal-Report File Definition Files
Task 3
Additional server variables are always in the
ax_database.ttx. Spreadsheet column-names are
always in the ax_table.ttx defined.
- Sample data definition file of SERVER-VARIABLESs
- Select Edit aX-DB to edit the server-variables
in the ax_database.ttx (default). - Define your server-variables
- The structure of the variables in the
data-definition-file is defined as follows - variablename TAB STRING TAB stringlength
additional server variables
15Create a Crystal-Report File Definition Files
Task 4
The variable name is defined in the same way as
in automationX defined (path variable).
- Sample data definition file of CLIENT-VARIABLESs
- 1. Open your report-directory and create a file
with following structure - name ltReportnamegtVis.ttx,
- as example "Bericht1Vis.ttx".
- 2. Open this file with a text-editor (notepad)
- 3. Define your client variables
- The structure of the variables in the
data-definition-file is defined as follows - variablename TAB STRING TAB stringlength
16How to print an AutomationX-SpreadSheet Report
Click on the spreadsheet with the mouse. Push
Strg RightMouseButton to open the spreadsheet
online-popup. Select Print to open the print
dialog.
Select Preview to open the crystal-report in
preview-mode. Start Line start-position of
report-table in spreadsheet-table End Line
end-position of report-table in
spreadsheet-table OK Start PRINTING or
PREVIEW
17Basic Study
- Which variables do you want to include in the
report? (1) - Do you want to create tables or do you only want
to insert single variables? (2) - Where do you want to call the axcrprint.exe?
- To bind automationX with crystal-report you have
to do following things - Define an existing automationx-variable in the
data-definition file - Configure this file as a data-source in the
report-file - Insert the variable into the report
- 1. If the variable-paths in the
data-definition-file are not valid, the specific
variables will not be found in automationX. - ? The effect is, that no report will be printed
out or previewed. - 2. Creating a report like a spreadsheet report is
only possible, if you use an ODBC(ADO) or DAO
data-source. - 3. You can only access local variables in the
tree of the calling process (axcrprint). - So you have access to tree-local variables
and global variables.
18Starting with Crystal-Report Wizard
- Start Crystal-Report Designer
- FILE ? NEW
- Select Database to create a data-source connection
19Creating a Data Definition File Task 1
The basic steps are the same like in the last
sessions described
- First create a new connection for Active Data
- ( Field Definitions Only)
- Push New to create a new definition file
20Creating a Data Definition File Task 2
- Insert the field name
- Select the field type ( always STRING !! )
- Insert a valid string-length
- Select Append to add the new variable to the
definition list - Close the popup with X at the left-top
- ? a message dialog will be opened
- YES, to commit changes to the field definition
file - NO, to avoid saving field definition file
21Creating a Data Definition File Task 3
- Saving the field definition file
- a) switch into the report-directory
- b) insert a valid name for your field
definition file - c) click Save to save the field
definition file - click Abort to cancel abort
saving - In the popup Select Data Source the active Data
Definition is displayed.
22Creating a Data Definition File Task 4
- The available tables are displayed in the
report-wizard - Push Add to append ax_test.ttx to the available
tables for the report - Close the database-popup by clicking on the
Close button - Push Next to switch to Fields
23Finishing with Crystal-Report Wizard Task 1
- In the tabsheet FIELDS, the available and for
display selected fields are shown. - Append Add available fields to the
displayfields - Append all Add all available fields to the
display-fields - You can edit the header-title after selecting a
display-field. - Push Finish to close this dialog and create a
report with the available fields and configured
options.
24Finishing with Crystal-Report Wizard Task 2
- At least you have to save the report-file in the
report directory. You have to insert this name in
the axcrprint-call.
25How to use axcrprint.exe
- Ab axcrprint call must be written into a callback
function in ACL. - The following sample describes, how to write the
StartProcess call.
SAMPLE path_axcrprint "bin\axcrprint.exe" pat
h filename of axcrprint.exe reportname "
-rprojects\testproject\Reports\Bericht1.rpt" path
filename of the reportfile ttxname "
dax_test.ttx" filename of datadefinition-file
optional1 " -verbose" optional for detailed
printinfo in dos-box optional2 " -preview"
optional for preview of report optional3 "
-bTEST.b" optional path of activebit
StartProcess(path_axcrprint,reportname,ttxname,o
ptional1, optional2,optional3)
26Exercise
27Expert Tips and Hints
- If you use an odbc or another database
connection, make sure that you have all runtime
files for crystal-report installed. - Following files are used by crystal-report in
combination with databases - System directory
- p2bdao.dll
- p2ctdao.dll
- p2irdao.dll
- p2sevt.dll
- P2smon.dll
- p2sodbc.dll
- If the report opens, but you cant see any values
of automationX, check if the data-source has been
updated. - If there is no error to see, try to create a new
data-source connection.
28Reference Material
- available from our web-site
- www.automationX.com
- Crystal Report developer help
- manual and help files (develop. version)
- Crystal Report
- Getting Started Guide (develop. version)
- Crystal Report web-site
- www.germany.seagatesoftware.com
- Crystal Report runtime-requirements
- Royalty Free Runtime.hlp and Runtime.hlp
End