dataflex reports developer guide - data access
TRANSCRIPT
in
DataFlex Reports
Developer Guide Integrate DataFlex Reports in your DataFlex Applications
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 2 of 183
z
Business Software for a Changing WorldTM
Please forward all your findings (suggestions, bugs in the documentation) to [email protected].
Technical support:
Internet: http://www.dataaccess.com
Forums: http://support.dataaccess.com/forums
E-mail: [email protected]
Revision Date: March, 2016
DataFlex Reports Developer
Guide
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 3 of 183
z
Business Software for a Changing WorldTM
COPYRIGHT NOTICE
© 2009-2016 DATA ACCESS CORPORATION. All rights reserved.
No part of this publication may be copied or distributed, transmitted, transcribed, stored in a retrieval
system, or translated into any human or computer language, in any form or by any means, electronic,
mechanical, magnetic, manual, or otherwise, or disclosed to third parties without the express written
permission of Data Access Corporation, Miami, Florida, USA.
DISCLAIMER
Data Access Corporation makes no representation or warranties express or implied, with respect to
this publication, or any Data Access Corporation product, including but not limited to warranties of
merchantability or fitness for any particular purpose.
Data Access Corporation reserves to itself the right to make changes, enhancements, revisions and
alterations of any kind to this publication or the product(s) it covers without obligation to notify any
person, institution or organization of such changes, enhancements, revisions and alterations.
TRADEMARKS
DataFlex is a trademark of Data Access Corporation.
All other company, brand, and product names are registered trademarks or trademarks of their
respective holders.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 4 of 183
z
Business Software for a Changing WorldTM
1. Table of Contents 1. TABLE OF CONTENTS ........................................................................................................................................... 4
2. WELCOME TO DATAFLEX REPORTS! .................................................................................................................... 7
3. APPLICATION INTEGRATION ............................................................................................................................... 8
3.1. ADDING THE DATAFLEX REPORTS LIBRARY TO A WORKSPACE ..................................................................................... 8 3.2. GETTING STARTED WITH THE INTEGRATION WIZARD ................................................................................................. 9
3.2.1. Report integration for Windows applications ..................................................................................... 10 3.2.1.1. Existing or New Report ................................................................................................................................... 10 3.2.1.2. Select Report .................................................................................................................................................. 10 3.2.1.3. Selection Fields ............................................................................................................................................... 11 3.2.1.4. Report Filters .................................................................................................................................................. 12 3.2.1.5. Parameter Fields ............................................................................................................................................ 12 3.2.1.6. Labels, Alignment and Anchors ...................................................................................................................... 13 3.2.1.7. Filter Operator................................................................................................................................................ 13 3.2.1.8. Sort Order ...................................................................................................................................................... 13 3.2.1.9. Functions ........................................................................................................................................................ 14 3.2.1.10. Preview Style ................................................................................................................................................ 14 3.2.1.11. Project Options ............................................................................................................................................ 15 3.2.1.12. Names .......................................................................................................................................................... 16 3.2.1.13. Language & ODBC data-source .................................................................................................................... 16 3.2.1.14. Component Finished .................................................................................................................................... 16
3.2.2. Report integration for DrillDown Mobile/Touch Web applications .................................................... 17 3.2.2.1. Existing or New Report ................................................................................................................................... 18 3.2.2.2. Select Report .................................................................................................................................................. 18 3.2.2.3. Webview Style ................................................................................................................................................ 19 3.2.2.4. Selection Criteria ............................................................................................................................................ 19 3.2.2.5. Report Filters .................................................................................................................................................. 20 3.2.2.6. Parameters ..................................................................................................................................................... 20 3.2.2.7. Labels, Justification and Position.................................................................................................................... 21 3.2.2.8. Filter Operator................................................................................................................................................ 21 3.2.2.9. Select & Zoom Views ...................................................................................................................................... 22 3.2.2.10. Sort Order .................................................................................................................................................... 23 3.2.2.11. Functions ...................................................................................................................................................... 23 3.2.2.12. Report View Options .................................................................................................................................... 24 3.2.2.13. Names .......................................................................................................................................................... 24 3.2.2.14. Language & ODBC data-source .................................................................................................................... 25 3.2.2.15. Component Finished .................................................................................................................................... 25
3.3. DATAFLEX REPORTS APPLICATION PROGRAMMING INTERFACE ................................................................................. 27 3.3.1. Column interface ................................................................................................................................. 27 3.3.2. Data source interface .......................................................................................................................... 27 3.3.3. Export interface ................................................................................................................................... 27 3.3.4. Filter interface ..................................................................................................................................... 27 3.3.5. Function interface ............................................................................................................................... 27 3.3.6. Language interface ............................................................................................................................. 28 3.3.7. Parameter interface ............................................................................................................................ 28 3.3.8. Preview interface................................................................................................................................. 28 3.3.9. Print interface ...................................................................................................................................... 28 3.3.10. Progress interface ............................................................................................................................. 28 3.3.11. Report interface ................................................................................................................................ 28 3.3.12. Sort interface ..................................................................................................................................... 29
3.4. REPORT INTEGRATION CLASSES ........................................................................................................................... 30
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 5 of 183
z
Business Software for a Changing WorldTM
3.4.1. cDRReport class ................................................................................................................................... 30 3.4.1.1. How to use the cDRReport class .................................................................................................................... 30 3.4.1.2. Translation ..................................................................................................................................................... 33 3.4.1.3. Properties ....................................................................................................................................................... 33 3.4.1.4. Events ............................................................................................................................................................. 66 3.4.1.5. Methods ......................................................................................................................................................... 74
3.4.2. cWebDRReport class ......................................................................................................................... 132 3.4.2.1. Properties ..................................................................................................................................................... 132 3.4.2.2. Events ........................................................................................................................................................... 133 3.4.2.3. Methods ....................................................................................................................................................... 133
3.4.3. cDRSortColumnsGrid class................................................................................................................. 137 3.4.3.1. Properties ..................................................................................................................................................... 139 3.4.3.2. Events ........................................................................................................................................................... 139 3.4.3.3. Methods ....................................................................................................................................................... 140
3.4.4. cDRSortDirectionsGridColumn class .................................................................................................. 141 3.4.4.1. Properties ..................................................................................................................................................... 141 3.4.4.2. Events ........................................................................................................................................................... 142 3.4.4.3. Methods ....................................................................................................................................................... 142
3.4.5. cDRMenuItem class ........................................................................................................................... 143 3.4.5.1. Properties ..................................................................................................................................................... 143 3.4.5.2. Events ........................................................................................................................................................... 144 3.4.5.3. Methods ....................................................................................................................................................... 144
3.4.6. cDRExportMenuItem class ................................................................................................................ 144 3.4.6.1. Properties ..................................................................................................................................................... 144
3.4.7. cDRPreview class ............................................................................................................................... 145 3.4.7.1. Child objects ................................................................................................................................................. 145 3.4.7.2. Properties ..................................................................................................................................................... 146 3.4.7.3. Events ........................................................................................................................................................... 146 3.4.7.4. Methods ....................................................................................................................................................... 147
3.4.8. cDRPreviewWindow class.................................................................................................................. 148 3.4.9. cDRToolPanelPreview class ............................................................................................................... 149
3.4.9.1. Child objects ................................................................................................................................................. 149 3.4.9.2. Properties ..................................................................................................................................................... 149 3.4.9.3. Events ........................................................................................................................................................... 150 3.4.9.4. Methods ....................................................................................................................................................... 150
3.4.10. cDRWebSortColumnsGrid class ....................................................................................................... 152 3.4.10.1. Properties ................................................................................................................................................... 153 3.4.10.2. Events ......................................................................................................................................................... 154 3.4.10.3. Methods ..................................................................................................................................................... 155
3.4.11. cDRWebSortDirectionColumn class ................................................................................................. 155 3.4.11.1. Properties ................................................................................................................................................... 155 3.4.11.2. Events ......................................................................................................................................................... 156
3.4.12. cWebDRReportViewer class ............................................................................................................ 157 3.4.12.1. Properties ................................................................................................................................................... 157 3.4.12.2. Events ......................................................................................................................................................... 160 3.4.12.3. Methods ..................................................................................................................................................... 162
3.5. TEMPLATES .................................................................................................................................................. 166 3.5.1. phoReport property ........................................................................................................................... 166 3.5.2. oCommandBars object ...................................................................................................................... 166 3.5.3. oDRToolbar object ............................................................................................................................. 166
3.5.3.1. First Page ...................................................................................................................................................... 166 3.5.3.2. Previous Page ............................................................................................................................................... 166 3.5.3.3. Current Page ................................................................................................................................................ 166 3.5.3.4. Next Page ..................................................................................................................................................... 166
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 6 of 183
z
Business Software for a Changing WorldTM
3.5.3.5. Last Page ...................................................................................................................................................... 167 3.5.3.6. Refresh Report Data ..................................................................................................................................... 167 3.5.3.7. Print Report Data ......................................................................................................................................... 167 3.5.3.8. Current Zoom Factor .................................................................................................................................... 167 3.5.3.9. Export Report Data ....................................................................................................................................... 167
3.5.4. oReport object ................................................................................................................................... 167 3.5.4.1. Events ........................................................................................................................................................... 167
3.5.5. Button Objects ................................................................................................................................... 167 3.5.6. Other Key Mappings .......................................................................................................................... 168
3.6. PRINTING ..................................................................................................................................................... 169 3.6.1. User Selects a Printer ........................................................................................................................ 169 3.6.2. Default Printer ................................................................................................................................... 169 3.6.3. Printing To a Specific Printer ............................................................................................................. 169
3.7. CONSTANTS.................................................................................................................................................. 170 3.7.1. Main Report ID .................................................................................................................................. 170 3.7.2. Database Types ................................................................................................................................. 170 3.7.3. Export formats................................................................................................................................... 170 3.7.4. HitTest ............................................................................................................................................... 170 3.7.5. Image formats ................................................................................................................................... 170 3.7.6. PDF page modes ................................................................................................................................ 170 3.7.7. PDF image qualities ........................................................................................................................... 171 3.7.8. PDF types ........................................................................................................................................... 171 3.7.9. Report statistics ................................................................................................................................. 171 3.7.10. Language ......................................................................................................................................... 171 3.7.11. Sort order ........................................................................................................................................ 173 3.7.12. Filter operators ................................................................................................................................ 173 3.7.13. OCX version and name .................................................................................................................... 173 3.7.14. Excel versions .................................................................................................................................. 173 3.7.15. Excel new sheet options .................................................................................................................. 174
3.8. STRUCTS ...................................................................................................................................................... 175 3.8.1. CSV export options ............................................................................................................................ 175 3.8.2. HTML export options ......................................................................................................................... 175 3.8.3. Image export options ........................................................................................................................ 175 3.8.4. PDF export options ............................................................................................................................ 175 3.8.5. RTF export options ............................................................................................................................ 176 3.8.6. Excel export options .......................................................................................................................... 176 3.8.7. Functions defined in a report ............................................................................................................ 176 3.8.8. Report tables in a runtime data source ............................................................................................. 176 3.8.9. Parameter information ..................................................................................................................... 176 3.8.10. Parameters defined in a report ....................................................................................................... 177
4. DEPLOYING THE DATAFLEX REPORTS DEVELOPER EDITION RUNTIME ........................................................... 178
5. PRODUCT SUPPORT......................................................................................................................................... 179
6. INDEX .............................................................................................................................................................. 180
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 7 of 183
z
Business Software for a Changing WorldTM
2. Welcome to DataFlex Reports! DataFlex Reports is a software tool for delivering timely, well organized reports and information to the
people who need it.
Designed to be used by end-users, power-users and professional software developers alike, DataFlex
Reports works with a wide variety of ODBC data sources including – but not limited to – Microsoft SQL
Server, IBM DB2, Oracle, MySQL, Pervasive SQL, PostgreSQL, Microsoft Access, the DataFlex
embedded database and more.
DataFlex Reports' Report Creation Wizard steps users through the entire process of creating a report
from selecting data sources to grouping, filtering, summarizing and sorting information. The wizard
displays the completed report in a visual, drag & drop WYSIWYG interface. Ready to view the results
on-screen, print or make further formatting changes and enhancements. A full range of text
formatting (fonts, bold, italics, justification, etc.) is available in DataFlex Reports along with a rich
library of string, logical and math functions.
DataFlex Reports is developed in DataFlex, the state-of-art software development tool from Data
Access Worldwide.
For DataFlex developers, DataFlex Reports offers both seamless integration with their DataFlex
development environment and seamless integration of reports in Windows and Web applications.
When DataFlex Reports is installed with DataFlex, a report integration wizard is automatically provided
in the Studio.
For deployment, reports integrated in DataFlex Windows applications require only the installation of a
single OCX. Distribution of integrated reports and the OCX is royalty-free with the Developer Edition of
DataFlex Reports. To use integrated reports with a Web application requires a Web Deployment
License.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 8 of 183
z
Business Software for a Changing WorldTM
3. Application Integration An Application Programming Interface (API) for DataFlex Studio is available. When DataFlex Reports
is installed on a computer, if an appropriate version of DataFlex Studio is already present, this API can
be optionally selected for automatic installation along with DataFlex Reports itself.
For the integration of DataFlex Reports in the DataFlex development environment a library workspace
is installed and a new wizard becomes available in the DataFlex Studio performing the following steps:
• Selection of the report to be integrated in the current workspace and project.
• Defining the criteria on which the end-user will be able to filter data when running the report.
• Defining the sort order of the report.
• Defining the Output Destinations that the end-user eventually can select.
• Generating a Report View in the Studio.
3.1. Adding the DataFlex Reports Library to a Workspace In order to be able to use integrated reports in a DataFlex workspace the
DataFlex Reports library must be added to that workspace.
Select the 'Maintain Libraries' option from the 'Tools' menu to add the
DataFlex Reports library to the current workspace. Browse to the
location of the DataFlex Reports library after clicking the 'Add Library'
button in the Library Maintenance dialog that opens. In the library folder
select the SWS file.
During the installation of DataFlex
Reports one or more library versions
could be installed. Depending on the
installed DataFlex version a library can
be installed or not.
Starting with DataFlex 18.2 the library
maintenance dialog contains a 'DataFlex
Reports Library' button. Clicking this
button instead of 'Add Library' looks at
usual locations (c:\libraries and .\libaries
inside the DataFlex root folder).
Working with an older version – or
when the library is not installed in one of the default locations – requires browsing to the library folder
that matches with the DataFlex product currently used and then select the SWS file from the folder.
Click the 'OK' button to connect the library to the workspace. A wizard will be started to guide through
the attach library process.
When using DataFlex 18.0 or older; on the first wizard page (after the usual welcome page) a choice
can be made to attempt to update the templates.xml file in the DataFlex Reports library. This feature
is needed if the path to the integration wizard stored in the templates.xml file is incorrect.
The content of the second page of the wizard depends on the current DataFlex product. If version
17.1 or later is used the page contains options regarding web application integration. The contents of
the library AppHtml\DataFlexReports folder need to be copied to the workspace if a web application is
developed and integration is desired. This action can be skipped if a Windows application is being
developed in the workspace. If a web application is developed the CSS files and a JavaScript file for
previewing DataFlex Reports need to be loaded. The wizard looks for a file named index.html (default
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 9 of 183
z
Business Software for a Changing WorldTM
for DataFlex web applications) and offer to update this file. The wizard shows all available CSS themes
available. Select the themes supported by the web application.
Starting with DataFlex 17.1 a folder named Reports as sibling of AppSrc and AppHtml will be the
suggested folder for reports in a workspace. Reports used in a web application might need to store
the output in a folder which is not directly accessible from the web browser. The suggested name is
Cache to be created inside the Reports folder. The wizard can create these folders.
All wizard activities can be logged in a text file. Used the contents of this log file to resolve problems
(if any).
3.2. Getting started with the Integration Wizard The library comes with a wizard that can write Windows or Web application components. The wizard
operates different based on the current selected project (which is a web or a Windows type of
application). First the Windows application integration is explained followed by Web application
integration.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 10 of 183
z
Business Software for a Changing WorldTM
3.2.1. Report integration for Windows applications
To start the wizard, go to the File menu and choose the 'New' option, followed by the 'View / Report'
option. The dialog to select from looks like:
For the explanation of the wizard that follows it is assumed that:
• The 'Order Entry' workspace is selected.
• The DataFlex Reports library is added to that workspace.
• A simple report, named CustomerList.dr, was created with DataFlex Reports in the Reports
folder showing customer data. A report with this name is present in the WebOrder example
folder and can be copied to the Reports folder of the 'Order Entry' workspace to bypass the
requirement of creating one.
• The Windows project (Orders.src) is selected in the workspace.
The first window explains the function of the wizard. Click 'Next' to proceed.
3.2.1.1. Existing or New Report
On the next page offers
connecting to an existing
report or the creation of a
new RDS (Runtime Data
Source) based report. For
now select 'Connect to an
existing report'.
3.2.1.2. Select Report
On the next page select
the report named
CustomerList.dr. The wizard looks in a folder Reports but the browse button can be used to select a
report from another folder. Selecting a report from another folder has impact on the functionality of
the wizard and the integration library. Selection list usage will not be made available for reports from
a folder outside the workspace. If the report is based on tables of the DataFlex embedded database
paths to the database or individual tables can be automatically corrected to the workspace paths.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 11 of 183
z
Business Software for a Changing WorldTM
Select the checkbox "Auto
correct DataFlex table
paths to workspace paths"
if this is desired. It should
not be selected if report
contains tables that are
not present in the
workspace without
developer coding. In such
a case it might be needed
to write own code to
connect report to data. If
the data is retrieved from
an ODBC or RDS data-
source this option has no
meaning. The preview
button can be used to
preview the report to
discover if the correct
report was selected.
Running a report without
selection criteria might take a while
and previewing should not be
chosen.
It is not possible to continue if the
report was not created with the
same version of the installed
DataFlex Reports OCX. An error as
shown here will be presented.
In such a case the report needs to be opened in the DataFlex Reports designer and saved to disk.
3.2.1.3. Selection Fields
In the next wizard page –
titled 'Selection Fields' – the
columns that allow the end-
user to specify selection
criteria can be selected. The
screenshot shows the
columns 'Customer_Number'
and 'Customer_City' as
selected columns. If the end-
user enters values in the
input controls the data will be
filtered on these values.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 12 of 183
z
Business Software for a Changing WorldTM
The order of the input controls can be changed via right mouse click as shown in above image.
Note: The wizard will automatically create a connection to a selection list component if the workspace
contains a data dictionary class for the table of the selected columns.
A drop-down (comboform) control will be created if the data dictionary contains a validation table for
the selected columns.
If no data dictionary can be found or if the report uses ODBC or RDS data this feature cannot be
offered and the developer would need to write own logic.
3.2.1.4. Report Filters
The next wizard page
depends on the report
definition. If the report
contains a filter (expert
and/or filter function) the
next wizard page(s) show
the filters. Editing of the
filter is not possible;
selecting to keep or remove
the filters can be done via
the radios below the grid.
Keeping the filter
definitions results in a
report that filters the data
on the predefined filter plus
the values from the
selection input controls.
3.2.1.5. Parameter Fields
This wizard page appears if the report contains parameters a page will be shown with the parameters.
One or more parameters
can be selected for the
creation of an input
control.
A checkbox below the list
of parameters makes it
possible to ask the wizard
to generate source code
for the parameters that
were not selected. Via
source code these
parameters can be given a
value. The reference
further in this guide
handles the parameter
usage.
The orderlist.dr report
does not contain
parameters
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 13 of 183
z
Business Software for a Changing WorldTM
3.2.1.6. Labels, Alignment and Anchors
If there are input controls
to be generated the wizard
shows a labels and
alignments page. On this
page the generated label(s)
for the input control(s) can
be changed.
Use the ‘justification’
drop=down to indicate if
the labels should be aligned
left, right or above the
control.
Use the ‘anchors’ drop-
down to indicate what
should happen with the
control when the container
resizes.
3.2.1.7. Filter Operator
This wizard page – only
available if fields for
selection criteria have been chosen – allows to choose the filter operator and whether the wizard
should create one of two input controls.
In most cases – especially
if the 'from' selection is
equal, less than, less than
or equal but also for the
other operators – only one
input control for selection
criteria is enough.
Accept the defaults or
change the filter operator
for each of the selection
fields.
3.2.1.8. Sort Order
After clicking 'Next' the
wizard makes it possible to
set the sort order of the
data displayed in the
details section of the
report.
The wizard shows the record sort order defined in the report if any.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 14 of 183
z
Business Software for a Changing WorldTM
With a right mouse click
or via the tool-bar the sort
direction (ascending or
descending) can be
selected per column. The
floating menu also makes
the sort order change-
able.
With the checkboxes
underneath the selected
sort columns list it is
possible to indicate that
code needs to be written
that allows the user to
change the sort order and
if this is a single sort order
or a multi column sort
order.
3.2.1.9. Functions
The next step in the wizard depends again on the report.
If the report or one of the
sub-reports contains user
defined functions the
wizard shows these
functions.
Each of the functions can
be inspected and selected
for code generation.
The wizard can generated
code for the functions that
are designed to have a
different value than
entered during report
creation can be changed
via source code.
3.2.1.10. Preview Style
The next wizard page
makes it possible to decide
what preview style to be
used if 'preview report' is chosen.
If the report results should be sent to a printer or export the preview style cannot be chosen and
running the report results in the output being sent to a printer or exported to a file.
The preview styles supported are:
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 15 of 183
z
Business Software for a Changing WorldTM
Modal dialog: Preview of
the results need to be
closed before further
interaction with the
application can be done.
MDI view: Preview style
interface dynamically
creates a view object
(MDI child window) in the
application's client area,
displaying the report
results.
Embedded in report view:
Results and selection
criteria needs to be
placed in the same view.
The wizard generates a
report view with two tab-
pages, one for the
selection criteria and one
for the results.
Toolpanel: This is a mix between a modal dialog and an MDI view. The results window pops out
(comparable to a modal dialog) of the program but navigation to other parts of the application are
possible (like an MDI view).
The checkbox for prompt list support can be ticked if creation of selection criteria controls is selected
earlier in the wizard process and prompt list support can be made available by the wizard. The
DataFlex framework supports two kinds of selection lists; the wizard cannot know what selection lists
are currently in use or will be used in the (near) future. Knowledge of the workspace contents is
necessary to make a correct decision.
3.2.1.11. Project Options
The next step in the
process concerns the
embedding of bitmaps and
icons in the executable.
The library contains a
number of images used in
a toolbar and in dialogs.
The images need to be
distributed with the
application as external
files or embedded in the
compiled project. The
DataFlex compiler embeds
the images listed in the
<project-name>.cfg file in
the compiled executable.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 16 of 183
z
Business Software for a Changing WorldTM
A workspace may contain several projects. Not all projects might need a connection to DataFlex
Reports. Select the projects for which the library bitmaps and icons need to be added to a project's
CFG file. Make sure the project's CFG file(s) is/are writeable.
3.2.1.12. Names
The next wizard page
requires specification of
the component object,
the file name and
description to be used for
the menu item creation.
If the object name does
not start with an 'o' the
wizard suggests to
change the name.
The wizard creates
names based on the
name of the chosen
report. The name shown
in the picture contains
CustomerList as the
report filename was
CustomerList.dr. The
object name needs be unique within the current project. The wizard cannot check if the name is
unique or not. The wizard will generate a ReportView based object that will be used to address the
module.
3.2.1.13. Language &
ODBC data-source
The next step in the wizard
is valid for Windows or
Web projects with DataFlex
Reports integration. By
choosing a language the
print engine translates
language items such as
‘Page N of M’ into the
chosen language.
If the report is based on an
ODBC data-source the
second option can be
selected which generates
code in the report object in
which a change in the data-
source can be
programmed.
3.2.1.14. Component Finished
After all your choices have been made we can finish the creation of the ReportView module by clicking
the 'Finish' button. The wizard will close and generates a Report View component.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 17 of 183
z
Business Software for a Changing WorldTM
The generated Report View is now available in DataFlex Studio.
Notice the prompt button for the selection of 'Customer
Number'. The selectionlist is available because the data
dictionary class for the customer table in this workspace defines
a selection list.
The controls are not data-aware, the view does not contain data
dictionary objects, browsing for a customer is not possible if not
using the selection list.
Once the Report View is created in DataFlex Studio, everything
is based on source-code. Double-clicking on the View (or
toggling to source view by pressing the F7-key) shows the
source-code.
The layout or position of any visual object in the ReportView component can be altered within the
DataFlex Studio designer.
It is worth taking a closer look at procedures – e.g. 'OnInitializeReport' & 'SetFilters' – created by the
wizard. For example the 'SetFilters' method which defines the report filter based on the user input.
Simply pressing the F5 key will compile and run the application. The
end-user can now easily make selections, set the sort order and then
preview, print or export the report results.
The report view does not need to have input controls for selections,
sort order and destination and can be condensed as only having a print and cancel button. In this
case the report contains everything that is needed to integrate or all options are fully coded in the
report or ReportView object. Copying the report object and a print button to a view like the order view
to only print the current order is fully supported.
3.2.2. Report integration for DrillDown Mobile/Touch Web applications
To start the wizard, go to the File menu and choose the 'New' option followed by the 'Web Object'
option. The dialog to select from looks like:
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 18 of 183
z
Business Software for a Changing WorldTM
For the explanation of the wizard that follows it is assumed that:
• The 'WebOrderMobile' workspace is selected.
• The DataFlex Reports library is added to that workspace.
• A simple report, named CustomerList.dr, was created with DataFlex Reports in the Reports
folder showing customer data. A report with this name is present.
• The Web project (WebApp.src) is selected in the workspace.
The first window explains the function of the wizard. Click 'Next' to proceed.
3.2.2.1. Existing or New Report
On the next page offers
connecting to an existing
report or the creation of a
new RDS (Runtime Data
Source) based report. For
now select 'Connect to an
existing report'
3.2.2.2. Select Report
On the next page select
the report named
CustomerList.dr. The wizard looks in a folder Reports but the browse button can be used to select a
report from another folder. Selecting a report from another folder has impact on the functionality of
the wizard and the
integration library. If the
report is based on tables of
the DataFlex embedded
database paths to the
database or individual
tables can be automatically
corrected to the workspace
paths. Select the checkbox
"Auto correct DataFlex table
paths to workspace paths"
if this is desired. It should
not be selected if report
contains tables that are not
present in the workspace
without developer coding.
In such a case it might be
needed to write own code
to connect report to data. If
the data is retrieved from
an ODBC or RDS data-
source this option has no meaning. The preview button can be used to preview the report to discover
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 19 of 183
z
Business Software for a Changing WorldTM
if the correct report was selected. Running a
report without selection criteria might take a
while and previewing should not be chosen.
It is not possible to continue if the report was
not created with the same version of the
installed DataFlex Reports OCX. An error as
shown here will be presented.
In such a case the report needs to be opened in the DataFlex Reports designer and saved to disk.
3.2.2.3. Webview Style
In the next wizard page select
"Drilldown – Mobile/Touch" for
the webview style.
Based on selecting the style
the wizard generates different
source code.
While combining "Desktop"
and "Drilldown –
Mobile/Touch" webviews is
possible within one project it is
easier, better to select the
component style that matches
the application style.
3.2.2.4. Selection Criteria
The next step in this
integration example is about
the creation of selection
criteria input controls.
Selection criteria can be
hard coded or a user can
be allowed to enter the
criteria values.
As shown; select the 'City'
and 'State' columns.
The wizard generates input
controls to enter these filter
values.
The order of the input
controls can be changed via
right mouse click as shown
in above image.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 20 of 183
z
Business Software for a Changing WorldTM
3.2.2.5. Report Filters
The next wizard page
depends on the report
definition. If the report
contains a filter (expert
and/or filter function) the
next wizard page(s) show
the filters. Editing of the
filter is not possible;
selecting to keep or remove
the filters can be done via
the radios below the grid.
The screenshot shows a
filter on the
customer_number column
and all rows not equal to
the value of 10 are valid.
Keeping the filter definitions
results in a report that
filters the data on the
predefined filter plus the values from the selection input controls.
3.2.2.6. Parameters
If the report contains parameters a page will be shown with the parameters. One or more parameters
can be selected for the creation of an input control.
A checkbox below the list of parameters make it possible to ask the wizard to generate source code
for the parameters that
were not selected.
Via source code these
parameters can be given a
value.
The reference further in
this guide handles the
parameter usage.
The customerlist.dr
report does not contain
parameters.
An input control will be
generated for each of the
selection and/or
parameter fields.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 21 of 183
z
Business Software for a Changing WorldTM
3.2.2.7. Labels, Justification and Position
The generated label for
the input control can be
changed in the labels
and alignment wizard
page. The page is only
available if there are
selection or parameter
input controls to be
created.
The 'Show' checkbox for
each label allows to
generate the label
setting but hide the
appearance.
Make your choice for the
label justification mode
and the label position
from their drop-downs at
the bottom of the page.
3.2.2.8. Filter Operator
This wizard page – only available if fields for selection criteria have been chosen – allows to choose
the filter operator and whether the wizard should create one of two input controls.
In most cases – especially if the 'from' selection is equal, less than, less than or equal but also for the
other operators – only one input control for selection criteria is enough.
Accept the defaults or
change the filter operator
for each of the selection
fields.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 22 of 183
z
Business Software for a Changing WorldTM
3.2.2.9. Select & Zoom Views
A typical DrillDown – Mobile/Touch application usually contains select and zoom webviews.
Based on the number of
selection criteria the wizard
makes it possible to
connect one or more
selection criteria to existing
'Select' views or to create a
new 'Select' view.
The connect-to or creation
of a select view is present
to help the user creating a
useful filter value.
The screenshot to the right
shows the 'to' column is
unavailable. This is because
in the previous wizard page
only a 'from' selection
criteria was chosen.
Clicking the prompt button
in the 'From' column brings
a Windows file selector dialog. Select the webview component that can be used to get the selection
criteria from.
If there was only one selection field chosen the wizard page would look like:
The first option lets the
wizard create a cWebList
control. Use this if there is
not a select view page
available yet or if this page
should be different.
Enhancements to the list can
be made after the select
view page is created by the
wizard.
The second option makes it
possible to connect to an
existing select view.
The third option tells the
wizard to create an input
control without connections
to a select view page.
The created page will be
very light as it will only contain one input control. Futher enhancement of the page is suggested.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 23 of 183
z
Business Software for a Changing WorldTM
3.2.2.10. Sort Order
After clicking 'Next' the wizard makes it possible to set the sort order of the data displayed in the
details section of the report.
The wizard shows the record sort order defined in the report if any.
With a right mouse click the
sort direction (ascending or
descending) can be selected
per column. The floating
menu also makes the sort
order change-able.
With the checkboxes
underneath the selected sort
columns list it is possible to
indicate that code needs to
be written that allows the
user to change the sort
order and if this is a single
sort order or a multi column
sort order.
3.2.2.11. Functions
The next step in the wizard
depends again on the
report.
If the report or one of the sub-reports contains user defined functions the wizard shows these
functions.
Each of the functions can be
inspected and selected for
code generation.
Functions that are designed
to have a different value
than entered during report
creation can be changed via
source code.
The customerlist.dr report
contains one function that
should not be changed at
integration level.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 24 of 183
z
Business Software for a Changing WorldTM
3.2.2.12. Report View Options
Next step in the integration process is the selection of the output representation. DataFlex Reports
can output to PDF, HTML, four image formats, XLS/XLSX, RTF (Word) and CSV. All formats are
supported at integration level.
HTML is the default output
option for DrillDown –
Mobile/Touch style
applications.
With each of the output
options different destination
options become available. For
example with HTML the
output can be shown in a
HTML previewer control on a
'Results' page or in the 'Select'
page. The wizard generates
two web components in case
of the 'HTML Viewer Results
Page' page destination option.
A web report view contains a column layout. The value for the number of columns in the web view
can be entered. Default is 12 and is usually ok. The value can be changed later in the DataFlex Studio.
Optionally a view width can
be entered. No value means
full width of the browser.
3.2.2.13. Names
When the user can enter
selection criteria, a sort
order or parameter values
the wizard creates two web
components. A select and a
results page.
If there is no UI only one
component will be created.
In the next wizard page(s)
the object name of the web
component, the name of the
source file on disk and a
description can be entered.
The default values shown
are based on the name of
the selected and opened report.
A confirmation question pops up if there is already a file with the entered name.
The name of the objects needs to be unique in the web project. The wizard cannot check if the names
are unique or not.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 25 of 183
z
Business Software for a Changing WorldTM
Printed in bold is shown that
this report view will be
added to WebApp.src which
is a confirmation that the
correct project type was
chosen.
3.2.2.14. Language & ODBC
data-source
In the next step of the
wizard it is possible to
choose if an instruction to
set a language should be
generated for translation of
language items such as
"Page N of M" into the
chosen language.
If the report is based on an
ODBC data-source the the
'Generate code for..'
checkbox can be selected. This generates a method in the report object in which a change in the
data-source can be programmed.
3.2.2.15. Component Finished
Next step in the process is finishing the wizard and the generation of the source code. The generated
code will be loaded in the DataFlex Studio and the newly generated select component will be added to
the webapp project and the 'View" pull-down.
Review the generated code and make visual enhancements like re-organizing the input controls.
Take a look at Studio's todolist panel to resolve the ToDo items created by the integration wizard.
The above screenshot shows the selection criteria for the customerlist report in the browser. Pressing
the 'Run Report' button or using the 'Run Report' option from the menu on the right results in:
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 26 of 183
z
Business Software for a Changing WorldTM
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 27 of 183
z
Business Software for a Changing WorldTM
3.3. DataFlex Reports Application Programming Interface Any report built by DataFlex Reports stores its definition in the file with the .DR extension. The
definition is read by the DataFlex Reports Runtime, which is actually an OCX. The OCX (named
DataFlex Reports 2016 Developer Edition API.ocx) can do more than just represent a report. The
runtime OCX contains several functions that are made available to programmers.
The interface functions can be grouped in sections for report, preview, data source, filter, function,
columns, export and progress. The following paragraphs provide a quick overview per group.
3.3.1. Column interface • ColumnCount String sReportId Integer iTable Returns Integer
• ColumnIndex String sReportId Integer iTable Integer iColumn Returns Integer
• ColumnLength String sReportId Integer iTable Integer iColumn Returns Integer
• ColumnName String sReportId Integer iTable Integer iColumn Returns String
• ColumnPrecision String sReportId Integer iTable Integer iColumn Returns Integer
• ColumnType String sReportId Integer iTable Integer iColumn Returns Integer
3.3.2. Data source interface • DatabaseCollate String sReportId Returns String
• DatabaseConnection String sReportId String sConnection
• DatabaseName String sReportId String sDatabaseName
• DatabaseType String sReportId Returns Integer
• TableCount String sReportId Returns Integer
• TableData String sReportId Integer iTable Variant[] vData
• TableName String sReportId Integer iTable String sName
• TableSchema String sReportId Integer iTable String sSchema
3.3.3. Export interface • CSVExportOptions String sReportId Integer pData
• HTMLExportOptions String sReportId Integer pData
• ImageExportOptions String sReportId Integer pData
• PDFExportOptions String sReportId Integer pData
• ReportExport String sReportId Integer iType String sFileName
• ReportHTMLPreview String sReportId Integer iArgSize Returns String[]
• XLSExportOptions String sReportId Integer pData
3.3.4. Filter interface • FilterFunction String sReportId String sFilter
• RecordFilterAdd String sReportId String sField Integer eOperator String sValue
• RecordFilterCount String sReportId Returns Integer
• RecordFilterDelete String sReportId Integer iFilter
• RecordFilterField String sReportId Integer iFilter String sField
• RecordFilterOperator String sReportId Integer iFilter Integer eOperator
• RecordFilterValue String sReportId Integer iFilter String sValue
3.3.5. Function interface • Function String sReportId Integer iFunction Returns String
• FunctionByName String sReportId String sFunctionName Returns Integer
• FunctionCheck String sReportId String sFunction Integer iIndex Returns Integer
• FunctionCount String sReportId Returns Integer
• FunctionError String sError Integer iLine Integer iColumn String sToken
• FunctionIsEmpty String sReportId String sFunction Returns Integer
• FunctionIsSymbolUsed String sReportId String sSymbol Returns Integer
• FunctionLength String sReportId String sFunction Returns Integer
• FunctionName String sReportId Integer iFunction Returns String
• FunctionType String sReportId String sFunction Returns Integer
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 28 of 183
z
Business Software for a Changing WorldTM
3.3.6. Language interface • ReportLanguage String sReportId Returns Integer
• ReportLanguageList String sReportId Returns Variant
3.3.7. Parameter interface • ParameterByName String sReportId String sParameterName Returns Integer
• ParameterCount String sReportId Returns Integer
• ParameterLength String sReportId Integer iParameter Returns Integer
• ParameterName String sReportId Returns String
• ParameterPrecision String sReportId Integer iParameter Returns Integer
• ParameterType String sReportId Returns Integer
• ParameterValue String sReportId Integer iParameter Returns String
3.3.8. Preview interface • PreviewClick Integer iPos Integer iSectionId String
• PreviewCurrentPage Integer iPage
• PreviewFind String sString Integer bDown Integer bWholeWord Integer bMatchCase
• PreviewFirstPage
• PreviewHScroll Integer iType Integer iPos
• PreviewHWND Integer hWnd
• PreviewLastPage
• PreviewNextPage
• PreviewPaint
• PreviewPreviousPage
• PreviewShowPage Integer iPage
• PreviewVScroll Integer iType Integer iPos
• PreviewZoom Integer iZoom
• PreviewZoomChanged Integer iZoom
3.3.9. Print interface • PaperMarginBottom Integer iBottomMargin
• PaperMarginLeft Integer iLeftMargin
• PaperMarginRight Integer iRightMargin
• PaperMarginTop Integer iTopMargin
• PaperOrientation String sReportId Returns Integer
• PaperSize String sReportId Returns Integer
• ReportPrint String sReportId Integer hPrintDlg
3.3.10. Progress interface • ProgressCountPage Integer iPage
• ProgressExportPage Integer iPage Integer iTotalPages
• ProgressFormatPage Integer iPage Integer iTotalPages
• ProgressRecordsRead Integer iRecords
3.3.11. Report interface • ReportCancel String sReportId
• ReportClose String sReportId
• ReportError Integer iError String sError
• ReportInfo Integer iError String sError
• ReportName String sReportId Returns String
• ReportOpen String sReport Returns String
• ReportPageCount String sReportId Returns Integer
• ReportPreview String sReportId
• ReportQuery String sReportId Returns String
• ReportRefresh String sReportId
• ReportStatistics Integer iType Integer iValue
• SubReportCount String sReportId Returns Integer
• SubReportId String sReportId Integer iIndex Returns String
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 29 of 183
z
Business Software for a Changing WorldTM
3.3.12. Sort interface • RecordSortAdd String sReportId String sSortField Integer eSortOrder
• RecordSortCount String sReportId Returns Integer
• RecordSortDelete String sReportId Integer iIndex
• RecordSortField String sReportId Integer iIndex Returns String
• RecordSortOrder String sReportId Integer iIndex Returns Integer
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 30 of 183
z
Business Software for a Changing WorldTM
3.4. Report integration classes The DataFlex Reports integration library contains two major classes for report integration in an
application. The cDRReport class can be used in all kind of applications while the cWebDRReport class –
a sub-class of cDRReport – is designed for web application integration.
3.4.1. cDRReport class
The cDRReport class is a subclass of the cDRAPI ActiveX wrapper class, which should not be used for
object instantiation. For this the cDRAPI class is marked as abstract and thus the cDRReport class
should be used. The interface in the cDRReport class protects against writing incorrect code
instructions.
For printer selection and controlling the PrintReport method you use an object of the cPrintDialog
class, which is a class that we supply with the DataFlex Reports library.
3.4.1.1. How to use the cDRReport class
Running reports side-by-side can be done by creating multiple instances of the cDRReport class at the
same time, if the preview output is not sent to a modal dialog. Running ReportA and then ReportB can
be done using one instance of the cDRReport class.
The most important property of the cDRReport object is the psReportName property which needs to be
set to the filename of the report (e.g. CustomerList.dr). Without this the engine won't know what
report to execute. The property can be set in a static or dynamic way. The report file name in
psReportName may contain a path. Normally no path is given if the report resides in a folder of the
application's workspace. If a path is not specified an attempt is made to locate the report by the
OpenReport function. The following sequence is used to locate the report, until the report file is found
or no report file by the specified name is found.
1. The folder location can be stored in a property named psReportPath. Even if this property is not
empty the report file may not be there.
2. Only when compiling and running with DataFlex 17.1 or later, the Reports folder is searched for
the report. The location of the Reports folder is returned by a function named ReportsFolder. The
default is a folder named Reports in the root of the workspace.
3. The folders of the application's data paths are enumerated to locate the report. The application's
data paths are stored in the DataPath setting in the workspace file (e.g config.ws). This value is
programmatically accessible via the psDataPath property of the workspace object in the
application.
Note that when the project does not have an application object (instance of cApplication) – this is
very rare – there is no workspace object, there are no data paths, there is no Reports folder. The path
to the report filename needs to be part of the file in the psReportname or the psReportPath property
must be set to the location of the reports.
Before report settings can be queried or altered the report must be opened using the OpenReport
function. The OpenReport function returns the report ID, which is a GUID (Globally Unique Identifier).
If the report cannot be opened the return value will be an empty string.
If the report uses tables from the DataFlex embedded database (or tables from an external database
described by intermediate (INT) files) the class will attempt to automatically locate the database and
tables and adjust paths in the report at runtime. This change of table location is not persistent. If the
workspace contains multiple tables with the same name or when it uses a different technique to
locate and open tables it is better to set the pbAutoLocateDFFiles property to false.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 31 of 183
z
Business Software for a Changing WorldTM
If a manual change of the location of the database and tables is desired the properties
psDatabaseName, DatabaseType, psDatabaseConnection, and psTableSchema should be used.
psDatabaseName contains the name of the filelist or the first table in an environment using the
embedded DataFlex database, DatabaseType indicates whether it is an embedded DataFlex database
that is used or an ODBC datasource, psDatabaseConnection contains the DataFlex DF_OPEN_PATH or the
DSN that gives access to the ODBC datasource, and psTableSchema contains the path to a table when
the embedded DataFlex database is used and tables are not opened via the filelist or the table schema
if available in case of an ODBC datasource.
The property psTableName returns the name of the N-th table in the report. The function TableCount
returns the number of tables present in the report. If the report is based on an ODBC or Stored
Procedure datasource it is possible to let the integration wizard generate code to assist in changing
the DSN for the report, look for a method called ChangeODBCDataSource.
An opened report can be displayed; its data can be exported or printed to a print device. Sending the
RunReport message to the report will open the report and then output the report to screen, printer or
file. The method of output is controlled by the property peOutputDestination which can have the
values PRINT_TO_WINDOW, PRINT_TO_PRINTER, PRINT_TO_PRINTER_NO_DIALOG or PRINT_TO_FILE. The report
remains open after output. If the report was not opened before sending RunReport to the report object
results in an attempt to open the report by calling the OpenReport method. As mentioned above the
OpenReport message can be send to only open the report and change or query some settings with or
without creating output.
During OpenReport it is possible to show a status panel to the end-user. This is controlled by the
property pbShowStatusPanel in combination with the property phoStatusPanel that holds the object id
of the statuspanel. Both properties need to be set by the developer and are false and 0 by default.
If the output of the report is expected to take some time it would be good to display information
about reading and processing data to the end-user. This can be done by implementing the event
OnProgressRecordsRead and displaying the number of records read and/or the event
OnProgressFormatPage to display how many pages have been formatted out of the total number of
pages. The integration wizard already writes the code for these events in the cDRReport object.
Instead of running the report and depending on the property peOutputDestination it is possible to
open the report (with the OpenReport function) and then either send the message DisplayReport,
ExportReport or PrintReport. The report must be opened before one of these three messages can be
sent.
When the report executes, the DataFlex application continues to respond to mouse clicks, function
keys etc. since the report data reading and formatting process is done in an ActiveX module.
For exporting or printing the report it is not necessary for the ActiveX to be displayed in a DataFlex
container object (e.g. a (db)View).
After opening the report, record filters can be set in two ways. One way is via the psFilterFunction
property. The syntax of the VB Like function code that needs to be written for this function can be
checked via the function TestFilterFunction. It is not a requirement though. The second way is via
the methods AddFilter, RemoveFilter, RemoveAllFilters. Existing filters can be altered via the method
FilterCount in combination with the properties psFilterField, peFilterOperator and psFilterValue.
The class also gives access to any of the stored functions in the report. The number of functions can
be queried via the method FunctionCount. Each function can be addressed via the methods
psFunctionName and psFunction. If the function name is known, the FunctionIdByName returns the
function ID. It is not possible to add new functions to the report, only to change existing functions.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 32 of 183
z
Business Software for a Changing WorldTM
A report may contain one or more sub-report(s). A sub-report may contain one or more other sub-
report(s). The number of nested sub-reports is not limited but using sub-reports has an impact on the
execution speed. The number of sub-reports in a report can be queried via the method
SubReportCount and their IDs can be retrieved via the function SubReportID. The sub-report can and
should be further accessed in its entirety as if it was a report on its own. If the pbAutoLocateDFFiles is
set to false (or when an ODBC data-source is used) the data-sources in the sub-report(s) needs to be
adjusted manually (if needed). Each method that requires the passing of a report id can have the
main report id or the id of a sub-report passed.
For exporting the report a choice can be made between export to image, to CSV (Comma Separated
Values), to XLS (Excel), to RTF (Word), to Image, to HTML or to PDF (Portable Document Format). In
all six options a variable with the appropriate settings for the export format needs to be passed. For
this use the write only properties pImageExportOptions, pCSVExportOptions, pXLSExportOptions,
pHTMLExportOptions, pRTFExportOptions or pPDFExportOptions. The DataFlex Reports print engine
may crash if these properties are not set with appropriate information prior to the export.
When the report is displayed in the viewer and page navigation controls are desired, documentation
about the methods PreviewFirstPage, PreviewLastPage, PreviewNextPage, PreviewPreviousPage and
the property piPreviewCurrentPage should be read.
Any errors that are generated during any of the class methods, or which are sent to the object by the
viewer OCX, are automatically handled by the cDRReport object itself. As with the usual global
DataFlex error handler the method Error_Report is used. This method first determines if it is handling
errors already and if so skips the new error to avoid recursion. The next step in the process is calling
the OnError event which could be used to log error information into a log-file, send an e-mail etc.
When the property pbDisplayError is set to true (the default is True) the error is passed to the
standard error handler object. In the OnError event the pbDisplayError could be set to false to avoid
having the standard DataFlex error handler picking up the error. If the property pbCancelIfError is
true (the default is True) the pbCanceled property will be set to true to avoid follow-up errors in other
report methods.
Closing the report can be done with the CloseReport message. Don't do this while the report is still
needed (e.g. in viewing pages). When a different report is opened the old report will automatically be
closed. When the ActiveX object is deactivated (the dialog to where it was paged is deactivated or
during destroy) the currently opened report will be closed as well.
While using the DisplayReport message (or RunReport with the peOutputDestination set to
PRINT_TO_WINDOW, which is the default) the report object should have a size big enough to display the
report, or the preview window handle has to be set to an object big enough to display the report
results.
Report errors and special fields in the report can displayed/printed in a specific language. Use the
piReportLanguage property for specifying the language. The text strings for this language support are
read from a database named language.db which is delivered with DataFlex Reports. A set of popular
languages are delivered with DataFlex Reports.
If the data is sorted locally, the sort order is configurable when using ODBC and is standard for
DataFlex data.
Reports can be based on runtime data. To pass data the application has to build a two dimensional
variant array that matches the data source defined in the report and fill it with the data to be
displayed, exported or printed. The variant array is passed to the report via the TableData method.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 33 of 183
z
Business Software for a Changing WorldTM
A report can be based on a stored procedure that delivers the data to the report. The optional
parameters of a stored procedure can be accessed via the methods ParameterCount, ParameterName,
ParameterType and the property psParameterValue. These same methods and the property can be used
for parameters defined in the report.
Preview results can be shown via the ActiveX object on a (report)view, in a modal dialog, an MDI view
or a tool-panel. The pePreviewStyle property controls the display "channel".
Many functions and properties take a report ID as first argument. This report ID is the GUID (string
representation) returned by the OpenReport function. The value can be passed as an empty string (or
C_USEMAINDRREPORTID) if the main report is should be used. The function or property retrieves the
psReportID property value for the report ID.
In the next paragraphs detailed information about the properties, the methods and the events of the
cDRReport class can be found.
3.4.1.2. Translation
All messages and constants used in the cDRReport class and dialogs are available in a number of
languages. For each language the file that contains the translations is named
DRLanguage<languagename>.inc (e.g. DRLanguageDeutsch.inc) and is usually included by adding
DRLanguage.inc into the top of the code that needs the translation. The choice for the correct text
strings is the same as in the rest of the DataFlex applications, which means that the compiler constant
Language$Current determines what the translation is.
Requests for additional languages can be send to Data Access Europe by e-mail
The integration wizard uses dynamic translation following the language choice in the DataFlex Reports
designer. The translation strings are read from a database named language.db located in the
programs folder where the integration wizard is installed. When the translation cannot be found the
default English translation is used. Note that both the DataFlex Reports designer and the integration
wizard use a database named language.db but that the contents differ. The language.db for the
designer does not work for integration and vice-versa.
3.4.1.3. Properties
The cDRReport class defines the following properties
3.4.1.3.1. pbAllowMaximizeView
Type: Boolean
Default: False
Arguments: -
Description: This property is used by the cDRPreview class to set the Maximize_Icon of the
dynamically created view.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 34 of 183
z
Business Software for a Changing WorldTM
Type: Boolean
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set pbAllowMaximizeView to True End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Send DisplayReport of oReport End End_Procedure End_Object
3.4.1.3.2. pbAutoLocateDFFiles
Type: Boolean
Default: True
Arguments: -
Description: The location of database and tables for a DataFlex data-source in the report (and
sub-reports) is changed during OpenReport into a location relative to the workspace
data paths. The system only does this with tables without a path or when the path is
invalid when the DatabaseType indicates the report uses the DataFlex database as
data source.
The example shows what can be done if pbAutoLocateDFFiles is false.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set pbAutoLocateDFFiles to False End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Set psDatabaseName of oReport to ; 'c:\project\data\filelist.cfg' Send DisplayReport of oReport End End_Procedure End_Object
3.4.1.3.3. pbCanceled
Type: Boolean
Default: False
Arguments: -
Description: A developer may choose to cancel the report in OnInitializeReport, OnPrintReport,
OnExportReport or OnDisplayReport by setting this property to True.
If the property pbCanceled is set to True the print, display or export will be cancelled.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 35 of 183
z
Business Software for a Changing WorldTM
Type: Boolean
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin // We can now break its further actions Set pbCanceled of oReport to True // Now report will not be displayed Send DisplayReport of oReport End End_Procedure End_Object
3.4.1.3.4. pbCancelIfError
Type: Boolean
Default: True
Arguments: -
Description: Determines if the report handling will be canceled when an error occurs.
Sample: Object oReport is a cDRReport // invoke an error with a non-existent report Set psReportName to 'NonExistentReport.dr' Set pbCancelIfError to False End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Boolean bHasErrors Send DisplayReport of oReport Get pbHasErrors to bHasErrors End_Procedure End_Object
3.4.1.3.5. pCSVExportOptions
Type: drCSVExportOptions structure, see 3.8.1
Default: See 3.8.1
Arguments: -
Description: This write-only property needs to be set before export to CSV (ExportReport) can be
done. The property needs to be set to a value of the drCSVExportOptions data-type.
This property cannot be set before the report OCX object is initialized and a report is
opened (OpenReport).
The function DefaultCSVExportOptions can be called to initialize the
drCSVExportOptions variable.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 36 of 183
z
Business Software for a Changing WorldTM
Type: drCSVExportOptions structure, see 3.8.1
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oExportReportButton is a Button Set Label to 'Export Report' Procedure OnClick drCSVExportOptions CSVExportOptions String sReportId Get OpenReport Of oReport To sReportId // set the export options Move '"' to CSVExportOptions.cFieldDelimiter Move ',' to CSVExportOptions.cFieldSeparator Move False to CSVExportOptions.bExportGroupSections Move False to CSVExportOptions.bExportPageSections Move False to CSVExportOptions.bExportReportSections Move True to CSVExportOptions.bAllPages Move 1 to CSVExportOptions.iPage Set pCSVExportOptions of oReport to CSVExportOptions // exports the report to a file named ExportFile.csv Send ExportReport of oReport C_drCSV 'ExportFile.csv' End_Procedure End_Object
3.4.1.3.6. psDatabaseConnection
Type: String
Default: -
Arguments: Argument Description sReportId ID of the report to query. Can be ID of the main report or the
ID of a sub-report.
This argument can be passed as an empty string. The empty
string can be written as C_USEMAINDRREPORTID.
Description: If the data source is DataFlex, this property holds the DF_OPEN_PATH used to locate
the DataFlex filelist and tables.
If the data source is ODBC, this property holds the ODBC connection string (e.g. DSN=Dynamic AI Library Demo;DBQ=C:\Program Files\Dynamic AI\Dat\Dynamic AI
Library Demo.mdb;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5).
If the data source is RDS (Runtime Data Source), this holds the static name "Runtime
Datasource".
This property cannot be accessed before the report OCX object is initialized and a
report is opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 37 of 183
z
Business Software for a Changing WorldTM
Type: String
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Integer eDatabaseType String sDatabaseConnection Send RunReport of oReport Get psDatabaseConnection of oReport '' to sDatabaseConnection Get DatabaseType of oReport C_USEMAINDRREPORTID to eDatabaseType If (eDatabaseType = C_drDF) Begin Send Info_Box ('paths = ' + sDatabaseConnection) End If (eDatabaseType = C_drODBC) Begin Send Info_Box ('connection string = ' + sDatabaseConnection) End If (eDatabaseType = C_drRDS) Begin Send Info_Box ('connection string = ' + sDatabaseConnection) End End_Procedure End_Object
3.4.1.3.7. psDatabaseName
Type: String
Default: -
Arguments: Argument Description sReportId ID of the report to query. Can be ID of the main report or the
ID of a sub-report.
This argument can be passed as an empty string. The empty
string can be written as C_USEMAINDRREPORTID.
Description: If the data source is DataFlex (DatabaseType = C_drDF) and the filelist was used to
select tables this property holds the name and path of the filelist.cfg file. If
individual tables were used this property holds the name of the first table in the
report.
If the data source is ODBC (DatabaseType = C_drODBC, C_drSP or C_drSQL), this holds
the name of the database (Catalog name).
If the data source is RDS (Runtime Datasource, DatabaseType = C_drRDS), this holds
the static name "Runtime Datasource".
This property cannot be accessed before the report OCX object is initialized and a
report is opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 38 of 183
z
Business Software for a Changing WorldTM
Type: String
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Integer eDatabaseType String sReportId sDatabaseName Send RunReport of oReport Get psReportId of oReport to sReportId Get psDatabaseName of oReport sReportId to sDatabaseName Get DatabaseType of oReport sReportId to eDatabaseType If (eDatabaseType = C_drDF) Begin Send Info_Box ('filelist = ' + sDatabaseName) End If (eDatabaseType = C_drODBC) Begin Send Info_Box ('catalog = ' + sDatabaseName) End If (eDatabaseType = C_drRDS) Begin Send Info_Box ('database = ' + sDatabaseName) End End_Procedure End_Object
3.4.1.3.8. pbDisplayError
Type: Boolean
Default: True
Arguments: -
Description: Determines if errors will be displayed during the execution of the report.
For the display of the errors the standard DataFlex error handler system will be used
by sending Error_Report of the object whose ID was in the global Error_Object_Id
variable prior to a method execution.
The code in the example below shows the use of error logging in case errors are not
displayed.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 39 of 183
z
Business Software for a Changing WorldTM
Type: Boolean
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnError Integer iErrNum Integer iErrLine String sErrMsg Boolean bDisplayError Integer iChannel Get pbDisplayError to bDisplayError If (not (bDisplayError)) Begin Move (Seq_New_Channel ()) to iChannel If (iChannel >= 0 and iChannel <= 9) Begin Append_Output channel iChannel "DRError.Log" Writeln Channel iChannel (CurrentDateTime()) ' #:' ; iErrNum ' at: ' iErrLine ' "' sErrMsg '"' Close_Output Channel iChannel Send Seq_Release_Channel iChannel End End End_Procedure End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Set pbDisplayError of oReport to False Send RunReport of oReport End_Procedure End_Object
3.4.1.3.9. psExportFileName
Type: String
Default: -
Arguments: -
Description: Sets/Gets the name of the file used to export to.
Needs to be set before calling OutputReport when peOutputDestination is set to
PRINT_TO_FILE.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId drImageExportOptions ImageExportOptions Get OpenReport of oReport to sReportId Set peExportType of oReport to C_drImage Set psExportFileName of oReport to 'c:\tmp\MyOutput.jpg' // set the export options for image export Move C_drJPEG to ImageExportOptions.iImageType Move False to ImageExportOptions.bMultiPage Move 2 to ImageExportOptions.iPage Set pImageExportOptions of oReport to ImageExportOptions Send OutputReport of oReport End_Procedure End_Object
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 40 of 183
z
Business Software for a Changing WorldTM
3.4.1.3.10. phoExportOptionsDialog
Type: Handle
Default: In Windows applications: the object id of oDRExportOptionsDialog.
In Web applications: 0.
Arguments: -
Description: Contains the handle of a dialog that can be shown to handle export options.
It is used by OutputReport if peOutputDestination is set to PRINT_TO_FILE and
psExportFileName is empty.
An ExportReport message is sent to this handle.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set peOutputDestination to PRINT_TO_FILE Set phoExportOptionsDialog to oMyOwnExportOptionsDialog End_Object Object oOutputReportButton is a Button Set Label to 'Output Report' Procedure OnClick String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Send OutputReport of oReport End End_Procedure End_Object
3.4.1.3.11. peExportType
Type: Integer
Default: C_drPDF
Arguments: -
Description: Gets/Sets the type of export.
This property has to be set before sending the message OutputReport when the
peOutputDestination property is set to PRINT_TO_FILE.
The corresponding export options (pPDFExportOptions, pCSVExportOptions,
pImageExportOptions, pHTMLExportOptions, pRTFExportOptions or pXLSExportOptions)
should be set as well. If not set, default values are used.
Possible values:
Argument Description C_drCSV Export to Comma Separated Values (CSV) C_drHTML Export to HTML C_drImage Export to image (JPEG, TIFF, GIF, or PNG) C_drPDF Export to Portable Document Format (PDF) C_drRTF Export to Rich Text Format (RTF) C_drXLS Export to XLS or XLSX
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 41 of 183
z
Business Software for a Changing WorldTM
Type: Integer
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId drCSVExportOptions CSVExportOptions Get OpenReport of oReport to sReportId Set peExportType of oReport to C_drCSV Set psExportFileName of oReport to 'MyOutput.csv' // set the export options for the above specified CSV export Move '"' to CSVExportOptions.cFieldDelimiter Move '|' to CSVExportOptions.cFieldSeparator Move True to CSVExportOptions.bExportGroupSections Move True to CSVExportOptions.bExportPageSections Move True to CSVExportOptions.bExportReportSections Move False to CSVExportOptions.bSinglePage Move 1 to CSVExportOptions.iPage Set pCSVExportOptions of oReport to CSVExportOptions Send OutputReport of oReport End_Procedure End_Object
3.4.1.3.12. psFilterField
Type: String
Default: -
Arguments: Argument Description sReportId ID of the report to query. Can be ID of the main report or the
ID of a sub-report.
This argument can be passed as an empty string. The empty
string can be written as C_USEMAINDRREPORTID. iFilter The 0-based index of the filter.
Description: Sets/Gets the N-th filter field name of a report.
Filters can be added in the designer via the filter expert dialog or via the AddFilter
method. Trying to set psFilterField of a non-existing filter does not do anything and
gives no error.
Use this property together with peFilterOperator and psFilterValue.
This property cannot be accessed before the report OCX object is initialized and a
report is opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 42 of 183
z
Business Software for a Changing WorldTM
Type: String
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnInitializeReport Forward Send OnInitializeReport Set psFilterField C_USEMAINDRREPORTID 0 to ; '{Titles.YearPublished}' Set peFilterOperator C_USEMAINDRREPORTID 0 to C_drEqual Set psFilterValue C_USEMAINDRREPORTID 0 to 1984 End_Procedure End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sFilterField Send RunReport of oReport Get psFilterField of oReport C_USEMAINDRREPORTID ; 0 to sFilterField End_Procedure End_Object
3.4.1.3.13. psFilterFunction
Type: String
Default: -
Arguments: Argument Description sReportId ID of the report to query. Can be ID of the main report or the
ID of a sub-report.
This argument can be passed as an empty string. The empty
string can be written as C_USEMAINDRREPORTID.
Description: Sets/Gets the filter function of a report. Note that a VB like syntax is used.
Although the contents of the filter function are executed for each record, dependent
on the result (true or false), the record will or will not be used for the report. An
attempt is made to perform a jump into and out of index with the returned value. For
such an operation do not use a complex function with, for example, an IF statement.
This property cannot be accessed before the report OCX object is initialized and a
report is opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 43 of 183
z
Business Software for a Changing WorldTM
Type: String
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnInitializeReport Forward Send OnInitializeReport Set psFilterFunction C_USEMAINDRREPORTID to ; 'return ({Titles.YearPublished} = 1984)' End_Procedure End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sFilterFunction Send RunReport of oReport Get psFilterField of oReport C_USEMAINDRREPORTID ; to sFilterFunction End_Procedure End_Object
3.4.1.3.14. peFilterOperator
Type: Integer
Default: -
Arguments: Argument Description sReportId ID of the report to query. Can be ID of the main report or the
ID of a sub-report.
This argument can be passed as an empty string. The empty
string can be written as C_USEMAINDRREPORTID. iFilter The 0-based index of the filter.
Description: Sets/Gets the N-th filter operator of a report.
Filters can be added in the designer via the filter expert dialog or via the AddFilter
method. Trying to set peFilterOperator of a non-existing filter does not do anything
and gives no error.
Use this property together with psFilterField and psFilterValue.
This property cannot be accessed before the report OCX object is initialized and a
report is opened (OpenReport).
The possible filter operators are: • C_drNone
• C_drEqual
• C_drNotEqual
• C_drGreaterThan
• C_drGreaterThanOrEqual
• C_drLessThan
• C_drLessThanOrEqual
The use of C_drNone only makes sense when the DatabaseType is C_drDF and you
have a 3 or more segment index where you want to skip the second or subsequent
value but want to make use of the next values.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 44 of 183
z
Business Software for a Changing WorldTM
Type: Integer
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnInitializeReport Forward Send OnInitializeReport Set psFilterField C_USEMAINDRREPORTID 0 to ; '{Titles.YearPublished}' Set peFilterOperator C_USEMAINDRREPORTID 0 to C_drLessThan Set psFilterValue C_USEMAINDRREPORTID 0 to 1990 End_Procedure End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sFilterOperator Send RunReport of oReport Get psFilterOperator of oReport C_USEMAINDRREPORTID ; 0 to sFilterOperator End_Procedure End_Object
3.4.1.3.15. psFilterValue
Type: String
Default: -
Arguments: Argument Description sReportId ID of the report to query. Can be ID of the main report or the
ID of a sub-report.
This argument can be passed as an empty string. The empty
string can be written as C_USEMAINDRREPORTID. iFilter The 0-based index of the filter.
Description: Sets/Gets the N-th filter value of a report.
Filters can be added in the designer via the filter expert dialog or via the AddFilter
method. Trying to set psFilterValue of a non existing filter does not do anything and
gives no error.
Use this property together with psFilterField and peFilterOperator.
This property cannot be accessed before the report OCX object is initialized and a
report is opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 45 of 183
z
Business Software for a Changing WorldTM
Type: String
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnInitializeReport Forward Send OnInitializeReport Set psFilterField C_USEMAINDRREPORTID 0 to ; '{Titles.YearPublished}' Set peFilterOperator C_USEMAINDRREPORTID 0 to ; C_drGreaterThanOrEqual Set psFilterValue C_USEMAINDRREPORTID 0 to 1963 End_Procedure End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sFilterValue Send RunReport of oReport Get psFilterValue of oReport C_USEMAINDRREPORTID ; 0 to sFilterValue End_Procedure End_Object
3.4.1.3.16. psFunction
Type: String
Default: -
Arguments: Argument Description sReportId ID of the report to query. Can be ID of the main report or
the ID of a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. sFunctionName Name of the function to retrieve or set the contents of.
Description: Sets/Gets the contents of a function defined in the report.
If the report does not contain a function with the passed function name you will get
an error. You can use the function FunctionIdByName to find out if a function with a
certain name exists or not. The function will return the function id and when this is -1
(negative 1) the function does not exist.
This property cannot be accessed before the report OCX object is initialized and a
report is opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Send OpenReport of oReport to sReportId Set psFunction of oReport sReportId 'Version' ; to 'return "1.0.0.15"' End_Procedure End_Object
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 46 of 183
z
Business Software for a Changing WorldTM
3.4.1.3.17. psFunctionName
Type: String
Default: -
Arguments: Argument Description sReportId ID of the report to query. Can be ID of the main report or
the ID of a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. iFunctionId The N-th function in the report.
Description: Sets/Gets the name of the N-th function defined in the report.
Use the method FunctionCount to find out how many functions there are.
This property cannot be accessed before the report OCX object is initialized and a
report is opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Integer iFunction iFunctions String[] sFunctionNames String sReportId sSubReportId Get OpenReport of oReport to sReportId Get SubReportId Of oReport sReportId 1 to sSubReportId Get FunctionCount of oReport sSubReportId to iFunctions Move (ResizeArray (sFunctionNames, iFunctions)) to sFunctionNames Decrement iFunctions For iFunction From 0 To iFunctions Get psFunctionName of oReport sSubReportId iFunction to ; sFunctionNames[iFunction] Loop Send CloseReport sReportId End_Procedure End_Object
3.4.1.3.18. pbHasErrors
Type: Boolean
Default: False
Arguments: -
Description: If an error occurred in a report execution or loading the value of this property will be
True and your code can take decisions based on this state.
The OnError event can be used to log errors; shown in the sample code.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 47 of 183
z
Business Software for a Changing WorldTM
Type: Boolean
Sample: Object oReport is a cDRReport // invoke an error with a non-existent report Set psReportName to 'NonExistentReport.dr' Procedure OnError Integer iErrNum Integer iErrLine String sErrMsg Set pbDisplayError To False Send WriteToLogFile iErrNum iErrLine sErrMsg End_Procedure End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Boolean bHasErrors Send RunReport of oReport Get pbHasErrors of oReport to bHasErrors If (bHasErrors) Begin Send Info_Box 'An error occurred' End End_Procedure End_Object
3.4.1.3.19. pHTMLExportOptions
Type: drHTMLExportOptions structure, see 3.8.2
Default: See 3.8.2
Arguments: -
Description: This write-only property needs to be set before export to HTML format
(ExportReport) can be done. The property needs to be set to a value of the
drHTMLExportOptions data-type.
This property cannot be set before the report OCX object is initialized and a report is
opened (OpenReport).
The function DefaultHTMLExportOptions can be called to initialize the
drHTMLExportOptions variable.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oExportReportButton is a Button Set Label to 'Export Report' Procedure OnClick drHTMLExportOptions myExportOptions Get OpenReport Of oReport To sReportId // set the export options Move False to myExportOptions.bMultiPage Move 1 to myExportOptions.iPage Set pHTMLExportOptions of oReport to myExportOptions // exports the report to a file named ExportFile.html Send ExportReport of oReport C_drHTML 'c:\tmp\ExportFile.html' End_Procedure End_Object
3.4.1.3.20. pImageExportOptions
Type: drImageExportOptions structure, see 3.8.3
Default: See 3.8.3
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 48 of 183
z
Business Software for a Changing WorldTM
Type: drImageExportOptions structure, see 3.8.3
Arguments: -
Description: This write-only property needs to be set before export to image format
(ExportReport) can be done. The property needs to be set to a value of the
drImageExportOptions data-type.
This property cannot be set before the report OCX object is initialized and a report is
opened (OpenReport).
The function DefaultImageExportOptions can be called to initialize the
drImageExportOptions variable.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oExportReportButton is a Button Set Label to 'Export Report' Procedure OnClick drImageExportOptions myExportOptions Get OpenReport Of oReport To sReportId // set the export options Move C_drJPEG to myExportOptions.iImageType Move False to myExportOptions.bMultiPage Move 1 to myExportOptions.iPage Set pImageExportOptions of oReport to myExportOptions // exports the report to a file named ExportFile.jpg Send ExportReport of oReport C_drImage 'c:\tmp\ExportFile.jpg' End_Procedure End_Object
3.4.1.3.21. peOutputDestination
Type: Integer
Default: PRINT_TO_WINDOW
Arguments: -
Description: Determines how a report should be printed. The following modes are supported:
Constant Description PRINT_TO_FILE Output is sent directly to a file. PRINT_TO_WINDOW Output is sent to the viewer. As the
report is printed, the report can be
viewed in the viewer. PRINT_TO_PRINTER Output is sent directly to the printer. PRINT_TO_PRINTER_NO_DIALOG Output is sent directly to the default
printer.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 49 of 183
z
Business Software for a Changing WorldTM
Type: Integer
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Set peOutputDestination of oReport to PRINT_TO_WINDOW Send RunReport of oReport // Then also print the report Send PrintReport of oReport 0 End_Procedure End_Object
3.4.1.3.22. piPaperMarginBottom
Type: Integer
Default: -
Arguments: Argument Description sReportId ID of the report to query. Can be ID of the main report or
the ID of a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. iBottomMargin The bottom margin value.
Description: Sets or gets the size of the paper bottom margin. Margins are set during report
definition via the page setup option. While you can set the paper margin value it is
up to the printer to support this or not.
Margin values are in TWIPS (1/1440 inch or 1/567 cm).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set piPaperMarginBottom to 1360 // 2.4 cm * 567 End_Object
3.4.1.3.23. piPaperMarginLeft
Type: Integer
Default: -
Arguments: Argument Description sReportId ID of the report to query. Can be ID of the main report or
the ID of a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. iLeftMargin The left margin value.
Description: Sets or gets the size of the paper left margin. Margins are set during report definition
via the page setup option. While you can set the paper margin value it is up to the
printer to support this or not.
Margin values are in TWIPS (1/1440 inch or 1/567 cm).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 50 of 183
z
Business Software for a Changing WorldTM
Type: Integer
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set piPaperMarginLeft to 1359 // 2.398 cm * 567 End_Object
3.4.1.3.24. piPaperMarginRight
Type: Integer
Default: -
Arguments: Argument Description sReportId ID of the report to query. Can be ID of the main report or
the ID of a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. iRightMargin The right margin value.
Description: Sets or gets the size of the paper right margin. Margins are set during report
definition via the page setup option. While you can set the paper margin value it is
up to the printer to support this or not.
Margin values are in TWIPS (1/1440 inch or 1/567 cm).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set piPaperMarginRight to 1359 // 2.398 cm * 567 End_Object
3.4.1.3.25. piPaperMarginTop
Type: Integer
Default: -
Arguments: Argument Description sReportId ID of the report to query. Can be ID of the main report or
the ID of a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. iTopMargin The top margin value.
Description: Sets or gets the size of the paper top margin. Margins are set during report definition
via the page setup option. While you can set the paper margin value it is up to the
printer to support this or not.
Margin values are in TWIPS (1/1440 inch or 1/567 cm).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set piPaperMarginTopm to 1360 // 2.4 cm * 567 End_Object
3.4.1.3.26. psParameterValue
Type: String
Default: -
Arguments: Argument Description sReportId ID of the report to query. Can be ID of the main report or
the ID of a sub-report.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 51 of 183
z
Business Software for a Changing WorldTM
Type: String
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. iParameter The index of the parameter.
Description: Sets/Gets the value of the N-th parameter in a report based on a stored procedure or
a report that uses parameters.
A report can have 0 to N parameters. The number of parameters can be retrieved by
using the ParameterCount function. The type and name of each of the parameters can
be retrieved via ParameterType and ParameterName.
This property cannot be accessed before the report OCX object is initialized. This is
usually done inside the OpenReport method.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnInitializeReport Forward Send OnInitializeReport Set psParameterValue C_USEMAINDRREPORTID 0 to 'ACME' End_Procedure End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Integer iParameter String sParameterValue Send RunReport of oReport Get ParameterIdByName of oReport ; C_USEMAINDRREPORTID "CustomerID" to iParameter If (iParameter > -1) Begin Get psParameterValue of oReport ; C_USEMAINDRREPORTID iParameter to sParameterValue End End_Procedure End_Object
3.4.1.3.27. pPDFExportOptions
Type: drPDFExportOptions structure, see 3.8.4
Default: See 3.8.4
Arguments: -
Description: This write-only property needs to be set before export to PDF (ExportReport) can be
done. The property needs to be set to a value of the drPDFExportOptions data-type.
This property cannot be set before the report OCX object is initialized and a report is
opened (OpenReport).
The function DefaultPDFExportOptions can be called to initialize the
drPDFExportOptions variable.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 52 of 183
z
Business Software for a Changing WorldTM
Type: drPDFExportOptions structure, see 3.8.4
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oExportReportButton is a Button Set Label to 'Export Report' Procedure OnClick drPDFExportOptions myExportOptions Get OpenReport Of oReport To sReportId // set the export options Move C_drNormal to myExportOptions.iPageMode Move C_drPDFNormal to myExportOptions.iPDFType Move 'MyPassword' to myExportOptions.sOwnerPassword Move 'UserPassword' to myExportOptions.sUserPassword Move C_drLow to myExportOptions.iImageQuality Move True to myExportOptions.bAllPages Move 0 to myExportOptions.iPage Set pPDFExportOptions of oReport to myExportOptions // exports the report to a file named MyReport.pdf Send ExportReport of oReport C_drPDF 'c:\tmp\MyReport.pdf' End_Procedure End_Object
3.4.1.3.28. piPreviewCurrentPage
Type: Integer
Default: 1
Arguments: -
Description: Sets/Gets the current preview page number of a report.
This property cannot be accessed before the report OCX object is initialized and a
report is opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 53 of 183
z
Business Software for a Changing WorldTM
Type: Integer
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Send RunReport of oReport End_Procedure End_Object Object oPageNumberForm is a Form Set Label to 'Page:' End_Object Object oShowCurrentPageButton Is a Button Set Label to 'Show Current Page Number' Procedure OnClick Integer iPage Get piPreviewCurrentPage of oReport to iPage Set Value of oPageNumberForm to iPage End_Procedure End_Object Object oRunReportFromSecondPageButton is a Button Set Label to 'Run Report from page 2' Procedure OnClick // Start preview from page 2, assuming that page exists Set piPreviewCurrentPage of oReport to 2 End_Procedure End_Object
3.4.1.3.29. piPreviewZoom
Type: Integer
Default: 100
Arguments: -
Description: Sets/Gets preview zoom factor of a report. The contents of the viewer will be
zoomed in or out.
This property cannot be accessed before the report OCX object is initialized. This is
usually done inside the OpenReport method.
The value can be one of:
Value Description
25-500 Percentage of the original size.
-1 Zoom to page width.
-2 Zoom to full (whole) page.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 54 of 183
z
Business Software for a Changing WorldTM
Type: Integer
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oZoomForm is a Form Set Label to 'Zoom %:' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Integer iFactor Send RunReport of oReport Get piPreviewZoom of oReport to iFactor Set Value of oZoomForm to iFactor End_Procedure End_Object Object oChangeZoomButton is a Button Set Label to 'Zoom to 150%' Procedure OnClick // Set preview zoom factor of the current report to 150% Set piPreviewZoom of oReport to 150 End_Procedure End_Object
3.4.1.3.30. phoPrintDialog
Type: Handle
Default: Object handle of a child object from the cPrintDialog class.
Arguments: -
Description: This property contains the object handle of an automatically created child object
which is based on the cPrintDialog class. This object can be used to control printed
output.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set peOutputDestination to PRINT_TO_PRINTER End_Object Object oOutputReportButton is a Button Set Label to 'Output Report' Procedure OnClick Integer iFlags Handle hoPrintDialog Get phoPrintDialog to hoPrintDialog If (hoPrintDialog <> 0) Begin Get piFlags of hoPrintDialog to iFlags Move (iFlags iOr PD_COLLATE) To iFlags Set piFlags Of hoPrintDialog To iFlags End Send RunReport Of oReport End_Procedure End_Object
3.4.1.3.31. phPrintDlg
Type: Handle
Default: 0
Arguments: -
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 55 of 183
z
Business Software for a Changing WorldTM
Type: Handle
Description: This write-only property can be set to the address of a PrintDlgEx structure which
can be returned by an object of the cPrintDialog class. The value will be used by the
OutputReport method and passed to the PrintReport method.
When the value of this property remains zero and psPrinterName is empty the
PrintReport method will query the printer.
Setting the property to an invalid handle might result in a system crash. Results are
unknown.
For more information about the PRINTDLGEX structure see:
http://msdn.microsoft.com/library/ms646844.aspx
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set peOutputDestination to PRINT_TO_PRINTER End_Object Object oPrinterSelection Is A cPrintDialog Set pePaperSize to DMPAPER_A4 End_Object Object oOutputReportButton is a Button Set Label to 'Output Report' Procedure OnClick Integer iResult Handle hPrintDlg Get PrintDialog Of oPrinterSelection to iResult If (iResult = PD_RESULT_PRINT) Begin Get phPrintDlg Of oPrinterSelection To hPrintDlg Set phPrintDlg Of oReport to hPrintDlg End Send RunReport Of oReport End_Procedure End_Object
3.4.1.3.32. phcPreviewer
Type: Handle
Default: (RefClass(cDRPreview))
Arguments: -
Description: Determines the class of the object to be created if the pePreviewStyle is set to
C_DRPREVIEW_VIEW.
Change this property to use a different class to be used for the creation of an MDI
view.
Sample: Use cMySpecialPreviewer.Pkg Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set phcPreviewer to (RefClass (cMySpecialPreviewer)) End_Object
3.4.1.3.33. psPreviewCaptionLabel
Type: String
Default: -
Arguments: -
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 56 of 183
z
Business Software for a Changing WorldTM
Type: String
Description: The text to be displayed in the caption-bar of the preview container object can be
specified using this property.
The property is used by DisplayReport if pePreviewStyle is set to C_DRPREVIEW_MODAL,
C_DRPREVIEW_TOOLPANEL, or C_DRPREVIEW_VIEW.
DisplayReport will take the psReportName for the caption-bar text if this property is
not set (the psPreviewCaptionLabel will not be changed).
Sample: Use DRModalPreview.dg Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set phoPreviewContainer to oDRModalPreview Set pePreviewStyle to C_DRPREVIEW_MODAL Set psPreviewCaptionLabel to 'Results of MyReport' End_Object
3.4.1.3.34. phoPreviewContainer
Type: Handle
Default: 0
Arguments: -
Description: Use this property to tell DataFlex Reports to display the results of the report in an
alternative object. Usually this preview container object is instantiated from the
phcPreviewer class and contains an object instantiated from the cDRPreviewWindow
class.
If the pePreviewStyle property is set to C_DRPREVIEW_VIEW (the default) or
C_DRPREVIEW_TOOLPANEL and this property is zero (default) an object instantiated from
the class whose ID is stored in phcPreviewer is created and the phoPreviewContainer
property is set to the ID of the object created.
To display the results from a DisplayReport call in a modal dialog the pePreviewStyle
property is set to C_DRPREVIEW_MODAL and this property needs to be set to a modal
dialog component.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 57 of 183
z
Business Software for a Changing WorldTM
Type: Handle
Sample: Use DRModalPreview.dg Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set phoPreviewContainer to oDRModalPreview Set pePreviewStyle to C_DRPREVIEW_MODAL End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick // Requires the phoPreviewContainer object to be set to // a valid object ID for a result. Send DisplayReport of oReport End_Procedure End_Object Object oReport2 is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReport2Button is a Button Set Label to 'Run Report 2' Procedure OnClick // Creates a phcPreviewer object and stores the object id // in phoPreviewContainer Send DisplayReport of oReport2 End_Procedure End_Object
3.4.1.3.35. pePreviewStyle
Type: Integer
Default: C_DRPREVIEW_VIEW
Arguments: -
Description: Determines how DisplayReport will present the results of the report.
Switching the pePreviewStyle dynamically in a program is possible but requires a
closer look at the phoPreviewContainer property. The object might need to be
deactivated and destroyed.
The following values are supported:
Constant Description C_DRPREVIEW_VIEW Output is displayed on a dynamically created container
object. The class for the container object is stored in the
phcPreviewer property. The object ID created in
DisplayReport is stored in the phoPreviewContainer
property. C_DRPREVIEW_MODAL Output is displayed on a modal dialog. The object id of
this dialog needs to be stored in the
phoPreviewContainer property and is activated with a
Popup_Modal message. C_DRPREVIEW_EMBEDDED Output is displayed in the report object itself. C_DRPREVIEW_TOOLPANEL Output is displayed on a on a dynamically created
container object. The class for the container object is
stored in the phcPreviewer property. The object ID
created in DisplayReport is stored in the
phoPreviewContainer property.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 58 of 183
z
Business Software for a Changing WorldTM
Type: Integer
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set pePreviewStyle to C_DRPREVIEW_EMBEDDED End_Object
Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set pePreviewStyle to C_DRPREVIEW_TOOLPANEL Set phcPreviewer to (RefClass (cDRToolPanelPreview)) End_Object
3.4.1.3.36. psPrinterName
Type: String
Default: -
Arguments: -
Description: The exact name of the printer can be specified in this property if the report output
needs to be send to a printer and the printer selection dialog should be bypassed
while printing should not be send to the default printer.
If a printer is found with the specified name the output will be send to this printer. If
no printer with this name exists the normal print dialog is opened and the user can
select a printer or cancel the whole print operation.
The hPrintDlg parameter of the PrintReport method needs to be zero (default).
During PrintReport the paper orientation and size are copied from the report to the
print dialog object which is accessible via the object handle in phoPrintDialog.
Printing in a web application to a local printer should be done from the browser.
Printing to a printer accessible via the webserver should use this or the phPrintDlg
property. The printer selection dialog is not opened at the server level.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set peOutputDestination to PRINT_TO_PRINTER Set psPrinterName to "Dell 2330dn Laser Printer" End_Object Object oOutputReportButton is a Button Set Label to 'Output Report' Procedure OnClick Send RunReport Of oReport End_Procedure End_Object
3.4.1.3.37. psRecordSortField
Type: String
Default: -
Arguments: Argument Description sReportId ID of the report to query. Can be ID of the main report or
the ID of a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 59 of 183
z
Business Software for a Changing WorldTM
Type: String iSortFieldIndex The index of the sort field.
Description: Sets/Gets the field name of the N-th sort field of a report.
Sort fields can be added in the designer via the record sort expert dialog or via the
AddRecordSortField method. Trying to set psRecordSortField of a non-existing sort
field does not do anything and gives no error.
Use this property together with peRecordSortOrder.
This property cannot be accessed before the report OCX object is initialized and a
report is opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnInitializeReport Forward Send OnInitializeReport Set psRecordSortField C_USEMAINDRREPORTID 0 to ; '{Titles.YearPublished}' End_Procedure End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sRecordSortField Send RunReport of oReport Get psRecordSortField of oReport C_USEMAINDRREPORTID 0 ; to sRecordSortField End_Procedure End_Object
3.4.1.3.38. peRecordSortOrder
Type: Integer
Default: -
Arguments: Argument Description sReportId ID of the report to query. Can be ID of the main report or
the ID of a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. iSortFieldIndex The index of the sort field.
Description: Sets/Gets the ordering of the N-th sort field of a report.
Sort fields can be added in the designer via the record sort expert dialog or via the
AddRecordSortField method. Trying to set peRecordSortOrder of a non-existing sort
field does not do anything and gives no error.
Use this property together with psRecordSortField.
This property cannot be accessed before the report OCX object is initialized and a
report is opened (OpenReport).
The possible values are C_drAscending and C_drDescending.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 60 of 183
z
Business Software for a Changing WorldTM
Type: Integer
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnInitializeReport Forward Send OnInitializeReport Set peRecordSortOrder C_USEMAINDRREPORTID 0 to C_drDescending End_Procedure End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Integer eRecordSortOrder Send RunReport of oReport Get peRecordSortOrder of oReport C_USEMAINDRREPORTID 0 ; to eRecordSortOrder End_Procedure End_Object
3.4.1.3.39. psReportId
Type: String
Default: -
Arguments: -
Description: This read-only property holds the identifier of the currently opened report. The
property is automatically assigned the correct value inside the method OpenReport. If
the value is empty no report is loaded.
The value of the property should not be set by the developer.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Send RunReport of oReport Get psReportId of oReport to sReportId End_Procedure End_Object
3.4.1.3.40. piReportLanguage
Type: Integer
Default: LANG_NEUTRAL
Arguments: -
Description: The language of the report can be set in order to achieve the translation of error
messages and the contents of special fields. The language ID is specified as standard
in the Windows API (see http://msdn.microsoft.com/library/dd318693.aspx).
The report id argument currently has no meaning and can be left blank.
A typical location to set this property is the OnCreate event as it cannot be set before
the report object is instantiated.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 61 of 183
z
Business Software for a Changing WorldTM
Type: Integer
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnCreate Set piReportLanguage '' to LANG_GERMAN End_Procedure End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Send RunReport of oReport End_Procedure End_Object
3.4.1.3.41. psReportLocation
Type: String
Default: -
Arguments: -
Description: This read-only property holds the physical path to the report directory (for example
C:\SampleProject\Data\). It will be set by the OpenReport function.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportLocation Send RunReport of oReport Get psReportLocation of oReport to sReportLocation End_Procedure End_Object
3.4.1.3.42. psReportName
Type: String
Default: -
Arguments: -
Description: Should be set to the name of the DataFlex Reports report to be opened when
OpenReport or RunReport is sent to the object.
If a file name without path is used, the OpenReport method will attempt to locate the
report in the workspace. If the full path is included, this will be used to open the
report.
Sample: // Find report in workspace's report folder or the data path Object oReport is a cDRReport Set psReportName to 'SampleReport.dr' End_Object
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 62 of 183
z
Business Software for a Changing WorldTM
Type: String
// Find report in a subfolder named 'reports' of the workspace's data path Object oReport is a cDRReport Function ReportsFolder Returns String Function_Return '' End_Function Set psReportName to '\reports\SampleReport.dr' End_Object
// Find report in a specific location Object oReport is a cDRReport Set psReportName to 'C:\Reports\SampleReport.dr' End_Object
3.4.1.3.43. psReportPath
Type: String
Default: -
Arguments: -
Description: Can be set to hold a folder name to be used during OpenReport. Will be used if the
psReportName does not contain a path leading to a report definition.
If integration is used with DataFlex 2012 v17.1 and beyond it is better not to set this
property and rely on the ReportsFolder function.
Sample: // Find report in workspace's data path Object oReport is a cDRReport Set psReportPath to 'c:\reports' End_Object
3.4.1.3.44. pRTFExportOptions
Type: drRTFExportOptions structure, see 3.8.6
Default: See 3.8.6
Arguments: -
Description: This write-only property needs to be set before export to RTF format (ExportReport)
can be done. The property needs to be set to a value of the drRTFExportOptions
data-type.
This property cannot be set before the report OCX object is initialized and a report is
opened (OpenReport).
The function DefaultRTFExportOptions can be called to initialize the
drRTFExportOptions variable.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 63 of 183
z
Business Software for a Changing WorldTM
Type: drRTFExportOptions structure, see 3.8.6
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oExportReportButton is a Button Set Label to 'Export Report' Procedure OnClick drRTFExportOptions myExportOptions Get OpenReport Of oReport To sReportId // set the export options Move False to myExportOptions.bAllPages Move 1 to myExportOptions.iPage Set pRTFExportOptions of oReport to myExportOptions // exports the report to a file named ExportFile.rtf Send ExportReport of oReport C_drRTF 'c:\tmp\ExportFile.rtf' End_Procedure End_Object
3.4.1.3.45. pbShowStatusPanel
Type: Boolean
Default: False
Arguments: -
Description: Determines if a status panel will be displayed during the opening, displaying, printing
or exporting of the report. If the property phoStatusPanel does not have an object
identifier (handle) nothing happens.
Will not be used for web applications.
Sample: Use MyOwnStatusPanel.Dg Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set pbShowStatusPanel to True Set phoStatusPanel to oMyOwnStatusPanel End_Object
3.4.1.3.46. pbShowInformationMessages
Type: Boolean
Default: False
Arguments: -
Description: When set to True, the OnReportInfo event will show a Windows message box (only
when the report object is created in a Windows program environment) with report
information message texts.
An example of the information you might receive: a notify message given by the
database back-end about switching database context.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set pbShowInformationMessages to True End_Object
3.4.1.3.47. phoStatusPanel
Type: Handle
Default: 0
Arguments: -
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 64 of 183
z
Business Software for a Changing WorldTM
Type: Handle
Description: Contains the object identifier of the status panel which is displayed during the
opening of the report (the property pbShowStatusPanel must be set to True). The
object is activated by sending the Popup message; make sure the object has its
Popup_State set to true.
The library comes with a StatusPanel object for DataFlex Reports. Add Use
DRStatusPanel.dg to your code and use oDRStatusPanel as the object identifier for
this property to use this default status panel.
When an own status panel object is created its class should not be based on
ModalPanel because it halts the process after popup has been received. The
statuspanel object should have a focusable object.
Sample: Use DRStatusPanel.dg Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set pbShowStatusPanel to True Set phoStatusPanel to oDRStatusPanel End_Object
3.4.1.3.48. psTableName
Type: String
Default: -
Arguments: Argument Description sReportId ID of the report to query. Can be ID of the main report or
the ID of a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. iTable The index of the table in the report.
Description: Sets/Gets the table name of the table identified by the iTable argument.
Do not attempt to replace a table with another table that has a completely different
structure or column names (e.g. replace a table named customer by a table named
orders).
When a table number is passed that is higher than the number of tables in the report
or when it is negative an error will be generated.
This property cannot be accessed before the report OCX object is initialized and a
report is opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 65 of 183
z
Business Software for a Changing WorldTM
Type: String
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Get OpenReport of oReport to sReportId // Set the table of the second table to 'c:\orders\orders.dat' Set psTableName of oReport sReportId 1 to 'c:\orders\orders.dat' Send OutputReport of oReport End_Procedure End_Object
3.4.1.3.49. psTableSchema
Type: String
Default: -
Arguments: Argument Description sReportId ID of the report to query. Can be ID of the main report or
the ID of a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. iTable The index of the table in the report.
Description: Sets/Gets the schema name of the table identified by the iTable argument. When
the data source is the embedded database and the tables are selected via the filelist
this property returns an empty string value for each table. When the tables are
selected as individual tables the property returns the name (including the path) to
each of the tables.
When a table number is passed that is higher than the number of tables in the report
or when it is negative an error will be generated.
This property cannot be accessed before the report OCX object is initialized and a
report is opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Get OpenReport of oReport to sReportId // Set the schema of the second table to 'MySchema' Set psTableSchema of oReport sReportId 1 to 'MySchema' Send OutputReport of oReport End_Procedure End_Object
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 66 of 183
z
Business Software for a Changing WorldTM
3.4.1.3.50. pXLSExportOptions
Type: drXLSExportOptions structure, see 3.8.5
Default: See 3.8.5
Arguments: -
Description: This write-only property needs to be set before export to Excel (ExportReport) can
be done. The property needs to be set to a value of the drXLSExportOptions data-
type.
This property cannot be set before the report OCX object is initialized and a report is
opened (OpenReport).
The function DefaultXLSExportOptions can be called to initialize the
drXLSExportOptions variable.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oExportReportButton is a Button Set Label to 'Export Report' Procedure OnClick drXLSExportOptions myExportOptions Get OpenReport Of oReport To sReportId // set the export options Move C_drXLS2007 to XLSExportOptions.iXLSVersion Move C_drNoSheets to XLSExportOptions.iNewSheet Move 30 to XLSExportOptions.iColumnWidth Move False to XLSExportOptions.bExportDataOnly Move True to XLSExportOptions.bExportPageSections Move True to XLSExportOptions.bExportReportSections Move True to XLSExportOptions.bExportGroupSections Move False to XLSExportOptions.bAllPages Move 1 to XLSExportOptions.iPage Set pXLSExportOptions of oReport to myExportOptions // exports the report to a file named MyReport.xlsx Send ExportReport of oReport C_drXLS 'c:\tmp\MyReport.xlsx' End_Procedure End_Object
3.4.1.4. Events
3.4.1.4.1. OnClosePreviewer
Type: Procedure
Returns: -
Arguments: -
Description: This event is sent during closing of the previewer object in a modal dialog, a MDI
view or a tool panel.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnClosePreviewer Forward Send OnClosePreviewer Send LogMyAction End_Procedure End_Object
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 67 of 183
z
Business Software for a Changing WorldTM
3.4.1.4.2. OnDefineFilters
Type: Procedure
Returns: -
Arguments: -
Description: This event is sent during the RefreshReport method.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnDefineFilters String sReportId Integer iCustomerNum Get Value Of oCustomerNumForm to iCustomerNum Get psReportId to sReportId Send AddFilter sReportId '{Customer.State}' C_DREqual iCustomerNum End_Procedure End_Object
3.4.1.4.3. OnDisplayReport
Type: Procedure
Returns: -
Arguments: -
Description: This event is sent during the DisplayReport method.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnDisplayReport Integer iAnswer Forward Send OnDisplayReport // Would cancel the further display of the report Move (YesNo_Box ('Do you want to display the report', ; 'Confirmation', MB_DEFBUTTON2)) To iAnswer Set pbCanceled to (iAnswer = MBR_YES) End_Procedure End_Object
3.4.1.4.4. OnError
Type: Procedure
Returns: -
Arguments: Argument Description iErrNum The error number. iErrLine The line at which the error occurred. sErrMsg The message related to the occurring error.
Description: This event is fired whenever an error occurs.
It is possible to cancel further displaying of the error by setting the pbDisplayError
property to false.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 68 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Sample: Object oReport is a cDRReport // Set the report name to an non-existent report to invoke an error Set psReportName to 'NonExistentReport.dr' Procedure OnError Integer iErrNum Integer iErrLine String sErrMsg Integer iChannel Move (Seq_New_Channel()) to iChannel If (iChannel <> DF_SEQ_CHANNEL_NOT_AVAILABLE) Begin Append_Output Channel iChannel 'Report.Log' WriteLn iErrNum ' ' iErrLine ' ' sErrMsg Close_Output Channel iChannel Send Seq_Release_Channel iChannel End End_Procedure End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Send RunReport of oReport End_Procedure End_Object
3.4.1.4.5. OnExportReport
Type: Procedure
Returns: -
Arguments: Argument Description iExportType One of:
• C_drCSV
• C_drHTML
• C_drImage
• C_drPDF
• C_drRTF
• C_drXLS sFileName Name of the export file.
Description: This event is sent during the ExportReport method, before the actual export is done.
The export can be cancelled by setting pbCanceled.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnExportReport Integer iExportType String sFileName Forward Send OnExportReport iExportType sFileName // Would cancel the export of the report Set pbCanceled to (iExportType = C_drCSV) End_Procedure End_Object
3.4.1.4.6. OnInitializeReport
Type: Procedure
Returns: -
Arguments: -
Description: This event is sent by the object during the OpenReport method.
Setting of properties like peOutputDestination, removing or adding filters, sort orders
are typical actions programmed inside this event. If the data-source is RDS the array
with data is given to the print engine in this event.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 69 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Setting the property pbCanceled to true stops further loading of the report.
OpenReport will set psReportId to an empty string and will return an empty string.
Do not call the method yourself.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnInitializeReport Integer iSubReports Forward Send OnInitializeReport Send RemoveAllFilters '' // Would stop the report loading when the report contains // sub-reports Get SubReportCount '' to iSubReports Set pbCanceled to (iSubReports > 0) End_Procedure End_Object
3.4.1.4.7. OnPageChanged
Type: Procedure
Returns: -
Arguments: Argument Description iPage The current report page number.
Description: This event is sent by the object whenever a report page changes. The page number
can be displayed in a control in the report view or browse page buttons could be
enable/disable based on this value.
By default this event – when used in a Windows program – sends an OnPageChanged
message (with the same parameters) to the previewer object whose handle is in
phoPreviewContainer.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnPageChanged Integer iPage Set Value Of oCurrentPageForm To iPage End_Procedure End_Object
3.4.1.4.8. OnPostDisplayReport
Type: Procedure
Returns: -
Arguments: -
Description: This event is sent by the object at the end of a DisplayReport method.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 70 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnPostDisplayReport String sQuery Forward Send OnPostDisplayReport Get ReportQuery to sQuery End_Procedure End_Object
3.4.1.4.9. OnPostExportReport
Type: Procedure
Returns: -
Arguments: Argument Description iExportType One of:
• C_drCSV
• C_drHTML
• C_drImage
• C_drPDF
• C_drPDF
• C_drXLS sFileName Name of the export file.
Description: This event is sent by the object at the end of an ExportReport method. The event
can – as shown below – be used to open the export file at the end of the export
process.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnPostExportReport Integer iExportType String sFileName Handle hWnd Integer iRetval Forward Send OnPostExportReport iExportType sFileName Get Window_Handle to hWnd Move (DR_WinAPI_ShellExecute (hWnd, "OPEN", sFileName, "", "",; SW_SHOWDEFAULT)) to iRetval End_Procedure End_Object
3.4.1.4.10. OnPostPrintReport
Type: Procedure
Returns: -
Arguments: -
Description: This event is sent by the object at the end of a PrintReport method.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnPostPrintReport Forward Send OnPostPrintReport Send EmailToSomeOne 'New Print Made, please fetch' End_Procedure End_Object
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 71 of 183
z
Business Software for a Changing WorldTM
3.4.1.4.11. OnPreOpenReport
Type: Procedure
Returns: -
Arguments: -
Description: This event is sent by the object just before a report is opened. It can be used to
change settings on the report object before the report is opened.
Sample: Object oReport is a cDRReport Procedure OnPreOpenReport Forward Send OnPreOpenReport Set psReportName to 'MyReport.dr' End_Procedure End_Object
3.4.1.4.12. OnPrintReport
Type: Procedure
Returns: -
Arguments: Argument Description hPrintDlg Address of a PRINTDLGEX structure.
Description: This event is sent by the object during the PrintReport method.
When the property pbCanceled is set to true during this event the printing will not be
done.
The address of the PRINTDLGEX structure is passed and may be changed. Note that
this value might be zero which tells PrintReport to take care of the printer selection.
For more information about the PRINTDLGEX structure see:
http://msdn.microsoft.com/library/ms646844.aspx
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnPrintReport Handle ByRef hPrintDlg Forward Send OnPrintReport (&hPrintDlg) // Would cancel the printing Set pbCanceled to (Not (IsAdministrator())) End_Procedure End_Object
3.4.1.4.13. OnProgressFormatPage
Type: Procedure
Returns: -
Arguments: Argument Description iPage The page currently being formatted. iTotalPages The total number of pages to format.
Description: This procedure can be used to display how many pages are formatted so far. This
value can be displayed on a status panel.
The event is executed once in each 50 pages.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 72 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Sample: Use DRStatusPanel.dg Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set pbShowStatusPanel to True Set phoStatusPanel to oDRStatusPanel Procedure OnProgressFormatPage Integer iPage Integer iTotalPages Handle hoStatusPanel Forward Send OnProgressFormatPage iPage iTotalPages Get phoStatusPanel to hoStatusPanel Send SetStatusText of hoStatusPanel ("Pages formatted:" * ; String(iPage)) End_Procedure End_Object
3.4.1.4.14. OnProgressRecordsRead
Type: Procedure
Returns: -
Arguments: Argument Description iRecords The amount of records to read
Description: This procedure can be used to display how many records are read so far. This can be
displayed on a status panel.
This event is executed once in every 100 records.
Sample: Use DRStatusPanel.dg Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set pbShowStatusPanel to True Set phoStatusPanel to oDRStatusPanel Procedure OnProgressRecordsRead Integer iRecords Handle hoStatusPanel Forward Send OnProgressRecordsRead iRecords Get phoStatusPanel to hoStatusPanel Send SetStatusText of hoStatusPanel ("Records read:" * ; String(iRecords)) End_Procedure End_Object
3.4.1.4.15. OnReportInfo
Type: Procedure
Returns: -
Arguments: Argument Description iInfo A status number. sInfo The text of the information message.
Description: This procedure can be used to display or log information messages. An example of
such an information message is when Microsoft SQL server reports that the database
context has been changed.
The default implementation checks the property pbShowInformationMessages and if
true sends an Info_Box (Windows) or ShowInfoBox (Web) message.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 73 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Sample: Use Logger.Pkg Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnReportInfo Integer iInfo String sInfo String sReportName Get psReportName to sReportName Send WriteToLogFile Of oLogger sReportName iInfo ' ' sInfo End_Procedure End_Object
3.4.1.4.16. OnReportPreviewClick
Type: Procedure
Returns: -
Arguments: Argument Description iPos The position of the click in the report. Can be one of:
• C_drNowhere, clicked outside a section or report object.
• C_drSection, clicked in a section.
• C_drObject, clicked in a report object. iSectionId The value assigned as ID to the section. sObject Name of the object if iPos is C_drObject. sValue Value of the object if iPos is C_drObject.
Description: This procedure can be used to respond on user clicks in the preview. If multiple
objects exist with the same name it is important to setup the reports with unique IDs
for each section.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnReportPreviewClick C_drHitTests iPos Integer iSectionId ; String sObject String sValue If (iPos = C_drObject and iSectionId = 3 and ; sObject = 'Customer.CustomerId') Begin Send OpenCustomerView sValue End End_Procedure End_Object
3.4.1.4.17. OnReportStatistics
Type: Procedure
Returns: -
Arguments: Argument Description iType Holds the statistics type. Can be one of:
• C_drCountPages (Count Number Of Pages)
• C_drExecution (Execute SQL Statement)
• C_drExecutionPlan (Create SQL Statement)
• C_drFormatPages (Format Page)
• C_drReadRecords (Read Database Records)
• C_drReportOpen (Open Report)
• C_drSortRecords (Sort Records) iValue The value belonging to the type
Description: This procedure can be used to display the report statistics information that can help
in discovering where the time is spent.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 74 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnReportStatistics Integer iType Integer iValue If (iType = C_drFormatPage) Begin Set Value of oFormatPage to iValue End End_Procedure End_Object
3.4.1.4.18. OnShowPreviewer
Type: Procedure
Returns: -
Arguments: -
Description: This event gets fired when the previewer object – object ID stored in
phoPreviewContainer – is opened.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnShowPreviewer Handle hoPreviewContainer Get phoPreviewContainer to hoPreviewContainer Set Size of hoPreviewContainer to 490 580 End_Procedure End_Object
3.4.1.4.19. OnZoomChanged
Type: Procedure
Returns: -
Arguments: Argument Description iFactor Holds the zoom factor (percentage).
Description: This event is sent by the object whenever a report zoom mode changes. It can be
used to update a control that shows the current zoom factor.
For Windows applications the event by default sends OnZoomChanged to the previewer
object (phoPreviewContainer).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnZoomChanged Integer iFactor Set Value of oZoomFactorForm to iFactor End_Procedure End_Object
3.4.1.5. Methods
3.4.1.5.1. AddFilter
Type: Procedure
Returns: -
Arguments: Argument Description sReportId ID of the report to filter. Can be ID of the main report or the
ID of a sub-report.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 75 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
This argument can be passed as an empty string. The empty
string can be written as C_USEMAINDRREPORTID. sField One of the fields used in the report. eOperator One of the constants of compare. The following values can be
used: • C_drEqual
• C_drNotEqual
• C_drGreaterThan
• C_drGreaterThanOrEqual
• C_drLessThan
• C_drLessThanOrEqual sFilterValue A value to filter against.
Description: Adds a record filter to the report in the same way as the DataFlex Reports Studio
does in the filter expert dialog.
The fieldname needs to be passed – as for example in AddFilter and psFilterFunction
– between curly braces and must exist in the report. Failing to specify a valid field
results in an error.
Existing filters can be removed by sending RemoveAllFilters.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Send AddFilter of oReport C_USEMAINDRREPORTID ; "{orderdetail.quantity}" C_drGreaterThanOrEqual 20 Send DisplayReport of oReport End End_Procedure End_Object
3.4.1.5.2. AddRecordSortField
Type: Procedure
Returns: -
Arguments: Argument Description sReportId ID of the report to sort. Can be ID of the main report or the
ID of a sub-report.
This argument can be passed as an empty string. The empty
string can be written as C_USEMAINDRREPORTID. sSortField One of the fields used in the report. eSortOrder Ascending or descending sorting. The following values are
allowed: • C_drAscending
• C_drDescending
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 76 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Description: Adds a field to the record sort order in the report in the same way as the DataFlex
Reports designer does in the record sort expert dialog.
The fieldname needs to be passed – as for example in AddFilter and
psFilterFunction – between curly braces and must exist in the report. Failing to
specify a valid field returns in an error.
You can remove the existing record sort fields by sending
RemoveAllRecordSortFields.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Send AddRecordSortField of oReport sReportId ; "{orderdetail.price}" C_drDescending Send DisplayReport of oReport End End_Procedure End_Object
3.4.1.5.3. CancelReport
Type: Procedure
Returns: -
Arguments: -
Description: Stops execution printing, previewing, exporting of the current report being executed.
Sets pbCanceled to true.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnReportInfo Integer iError String sInfo Send CancelReport End_Procedure End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Get RunReport of oReport End_Procedure End_Object
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 77 of 183
z
Business Software for a Changing WorldTM
3.4.1.5.4. CloseReport
Type: Procedure
Returns: -
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The empty
string can be written as C_USEMAINDRREPORTID.
Description: Closes a report and sets the psReportId to ''. The passed value is assumed to be the
identifier of the opened report.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Send OutputReport of oReport End End_Procedure End_Object Object oCloseReportButton is a Button Set Label to 'Close Report' Procedure OnClick String sReportId Get psReportId of oReport to sReportId If (sReportId <> '') Begin Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.5. DatabaseType
Type: Function
Returns: Integer, representing the type of database used:
• C_drDF (DataFlex)
• C_drODBC (ODBC)
• C_drRDS (Runtime Data Source)
• C_drSP (Stored Procedure)
• C_drSQL (SQL statement)
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The empty
string can be written as C_USEMAINDRREPORTID.
Description: Returns whether the used data source is based on DataFlex, ODBC, Runtime Data
Source, Stored Procedure or SQL statement based data.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 78 of 183
z
Business Software for a Changing WorldTM
Type: Function
This method cannot be used before the report OCX object is initialized and a report
was opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Integer eDatabaseType String sReportId sFileListName Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get DatabaseType of oReport '' to eDatabaseType If (eDatabaseType = C_drDF) Begin Get psDatabaseName of oReport to sFileListName End Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.6. DateTimeToString
Type: Function
Returns: String
Arguments: Argument Description dtIn Datetime value to be formatted as string.
Description: This function can be be used to format a DateTime variable as a string in an
YYYY-MM-DD HH:MM:SS format often used by SQL servers.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure Set ParamBeginningDate String sReportId String sValue Integer iParameter If (sReportId = '' or sValue = '') Procedure_Return Get DateTimeToString sValue to sValue Get ParameterIdByName sReportId "Beginning_Date" to iParameter Set psParameterValue sReportId iParameter to sValue End_Procedure End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId sFromBeginningDate Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get Value of oBeginningDate to sFromBeginningDate Set ParamBeginningDate of oReport sReportId ; to sFromBeginningDate Send DisplayReport of oReport End End_Procedure End_Object
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 79 of 183
z
Business Software for a Changing WorldTM
3.4.1.5.7. DateToString
Type: Function
Returns: String
Arguments: Argument Description dIn Date value to be formatted as string.
Description: This function can be be used to format a Date variable as a string in an YYYY-MM-DD
format often used by SQL servers.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure DefineBeginningDate String sReportId String sValue Integer iParameter If (sReportId = '' or sValue = '') Procedure_Return Get DateToString of oReport sValue to sValue Get ParameterIdByName of oReport sReportId "Beginning_Date" ; to iParameter Set psParameterValue of oReport sReportId iParameter to sValue End_Procedure Procedure OnClick String sReportId sFromBeginningDate Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get Value of oBeginningDate to sFromBeginningDate Send DefineBeginningDate sReportId sFromBeginningDate Send DisplayReport of oReport End End_Procedure End_Object
3.4.1.5.8. DefaultCSVExportOptions
Type: Function
Returns: drCSVExportOptions (see 3.8.1)
Arguments: -
Description: This function can be used return a default set of CSV export options. After retrieving
the default set of options one or more members can be changed.
The default initializes the members to:
Member Value cFieldDelimiter Comma (,) cFieldSeparator Double quote (") bExportPageSections False bExportReportSections False bExportGroupSections False bAllPages True iPage 1
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 80 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oExportReportButton is a Button Set Label to 'Export Report' Procedure OnClick String sReportId DRCSVExportOptions CSVExportOptions Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get DefaultCSVExportOptions of oReport to CSVExportOptions Set pCSVExportOptions of oReport to CSVExportOptions Send ExportReport of oReport C_drCSV 'MyReport.csv' Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.9. DefaultHTMLExportOptions
Type: Function
Returns: drHTMLExportOptions (see 3.8.2)
Arguments: -
Description: This function can be used return a default set of HTML export options. After
retrieving the default set of options one or more members can be changed.
The default initializes the members to:
Member Value bMultiPage True iPage 0
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oExportReportButton is a Button Set Label to 'Export Report' Procedure OnClick String sReportId DRHTMLExportOptions HTMLExportOptions Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get DefaultHTMLExportOptions of oReport to HTMLExportOptions Set pHTMLExportOptions of oReport to HTMLExportOptions Send ExportReport of oReport C_drHTML 'MyReport.html' Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.10. DefaultImageExportOptions
Type: Function
Returns: drImageExportOptions (see 3.8.3)
Arguments: -
Description: This function can be used return a default set of image export options. After
retrieving the default set of options one or more members can be changed.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 81 of 183
z
Business Software for a Changing WorldTM
Type: Function
The default initializes the members to:
Member Value iImageType C_drTIFF bMultiPage True iPage 0
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oExportReportButton is a Button Set Label to 'Export Report' Procedure OnClick String sReportId DRImageExportOptions ImageExportOptions Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get DefaultImageExportOptions of oReport to ImageExportOptions Set pImageExportOptions of oReport to ImageExportOptions Send ExportReport of oReport C_drImage 'MyReport.tiff' Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.11. DefaultPDFExportOptions
Type: Function
Returns: drPDFExportOptions (see 3.8.4)
Arguments: -
Description: This function can be used return a default set of PDF export options. After retrieving
the default set of options one or more members can be changed.
The default initializes the members to:
Member Value iPageMode C_drNormal iPDFType C_drPDFNormal
sOwnerPassword '' sUserPassword '' iImageQuality C_drLow bAllPages True iPage 0
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 82 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oExportReportButton is a Button Set Label to 'Export Report' Procedure OnClick String sReportId DRPDFExportOptions PDFExportOptions Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get DefaultPDFExportOptions of oReport to PDFExportOptions Set pPDFExportOptions of oReport to PDFExportOptions Send ExportReport of oReport C_drPDF 'MyReport.pdf' Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.12. DefaultRTFExportOptions
Type: Function
Returns: drRTFExportOptions (see 3.8.5)
Arguments: -
Description: This function can be used return a default set of RTF export options. After retrieving
the default set of options one or more members can be changed.
The default initializes the members to:
Member Value bAllPages True iPage 1
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oExportReportButton is a Button Set Label to 'Export Report' Procedure OnClick String sReportId DRRTFExportOptions RTFExportOptions Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get DefaultRTFExportOptions of oReport to RTFExportOptions Set pRTFExportOptions of oReport to RTFExportOptions Send ExportReport of oReport C_drRTF 'MyReport.rtf' Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.13. DefaultXLSExportOptions
Type: Function
Returns: drXLSExportOptions (see 3.8.6)
Arguments: -
Description: This function can be used return a default set of XLS export options. After retrieving
the default set of options one or more members can be changed.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 83 of 183
z
Business Software for a Changing WorldTM
Type: Function
The default initializes the members to:
Member Value iXLSVersion C_DRXLS2007 iNewSheet C_DRNoSheets iColumnWidth 30 bExportDataOnly False bExportPageSections True bExportReportSections True bExportGroupSections True bAllPages True iPage 1
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oExportReportButton is a Button Set Label to 'Export Report' Procedure OnClick String sReportId DRXLSExportOptions XLSExportOptions Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get DefaultXLSExportOptions of oReport to XLSExportOptions Set pXLSExportOptions of oReport to XLSExportOptions Send ExportReport of oReport C_drXLS 'MyReport.xls' Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.14. DisplayReport
Type: Procedure
Returns: -
Arguments: -
Description: Displays the report in the report viewer.
At the beginning of the display the event OnDisplayReport is fired. Cancel of the
display can be done by setting the pbCanceled property to true in this event.
Sends the Popup message to the object-id stored in the phoStatusPanel property if
pbShowStatusPanel is true.
At the end of the method the event OnPostDisplayReport is fired.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
This method is not available for Web Applications.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 84 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Send DisplayReport of oReport End End_Procedure End_Object
3.4.1.5.15. DisplayStatusPanel
Type: Procedure
Returns: -
Arguments: Argument Description bShow True if the statuspanel must be displayed, or false otherwise.
Description: This method takes care of the showing and hiding of the statuspanel object and is
called by: DisplayReport, ExportReport, OpenReport, PrintReport, and RefreshReport.
A status panel will only be shown if pbShowStatusPanel is set to true and
phoStatusPanel contains an object ID.
This method is not available for Web Applications.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Send DisplayReport of oReport End End_Procedure End_Object
3.4.1.5.16. DRDate
Type: Function
Returns: String
Arguments: Argument Description dtValue DateTime value to be used inside the compare expression
that is built.
Description: Returns a string containing a call to the DateSerial conversion function available in
the function expression evaluator.
Notes:
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 85 of 183
z
Business Software for a Changing WorldTM
Type: Function
1. The result of this function cannot be used with the psFilterValue property or
the AddFilter method and is written specifically for the psFilterFunction
operation.
2. Filtervalue offloading to a server or index cannot be done if functions are used
inside the psFilterFunction; it is better to use DateToString or
DateTimeToString.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId sCompare sFunction Get OpenReport of oReport to sReportId Get DRDate of oReport 02/01/2012 to sCompare Move ('return ({product.release} = ' + sCompare + ')') ; to sFunction Set psFilterFunction of oReport sReportId to sFunction Send OutputReport of oReport End_Procedure End_Object
3.4.1.5.17. DRInteger
Type: Function
Returns: String
Arguments: Argument Description iValue Integer value to be used inside the compare expression
that is built.
Description: Returns a string containing a call to the CInt conversion function available in the
function expression evaluator.
Notes:
1. The result of this function cannot be used with the psFilterValue property or
the AddFilter method and is written specifically for the psFilterFunction
operation.
2. Filtervalue offloading to a server or index cannot be done if functions are
used inside the psFilterFunction; it is better to use the integer value
directly in the expression.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 86 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set peOutputDestination to PRINT_TO_FILE End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId sCompare sFunction Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get DRInteger of oReport 123 to sCompare Move ('return ({company.id} = ' + sCompare + ')') to sFunction Set psFilterFunction of oReport sReportId to sFunction Send OutputReport of oReport Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.18. DRNumber
Type: Function
Returns: String
Arguments: Argument Description nValue Number value to be used inside the compare expression
that is built.
Description: Returns a string containing a call to the CDbl conversion function available in the
function expression evaluator.
Notes:
1. The result of this function cannot be used with the psFilterValue property or
the AddFilter method and is written specifically for the psFilterFunction
operation.
2. Filtervalue offloading to a server or index cannot be done if functions are
used inside the psFilterFunction; it is better to use the number value
directly in the expression.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set peOutputDestination to PRINT_TO_FILE End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId sCompare sFunction Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get DRNumber of oReport 123.45 to sCompare Move ('return ({company.credit} = ' + sCompare + ')') ; to sFunction Set psFilterFunction of oReport sReportId to sFunction Send OutputReport of oReport Send CloseReport of oReport sReportId End End_Procedure End_Object
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 87 of 183
z
Business Software for a Changing WorldTM
3.4.1.5.19. DRString
Type: Function
Returns: String
Arguments: Argument Description sValue String value to be used inside the compare expression that
is built.
Description: Returns a string containing a call to the CStr conversion function available in the
function expression evaluator.
Notes:
1. The result of this function cannot be used with the psFilterValue property or
the AddFilter method and is written specifically for the psFilterFunction
operation.
2. Filtervalue offloading to a server or index cannot be done if functions are used
inside the psFilterFunction; it is better to use the string value directly in the
expression.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set peOutputDestination to PRINT_TO_FILE End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId sCompare sFunction Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get DRString of oReport 'Data Access' to sCompare Move ('return ({company.name} = ' + sCompare + ')') ; to sFunction Set psFilterFunction of oReport sReportId to sFunction Send OutputReport of oReport Send CloseReport of hoReport End End_Procedure End_Object
3.4.1.5.20. ExportReport
Type: Procedure
Returns: -
Arguments: Argument Description iExportType The export file format. Can be one of:
• C_drCSV
• C_drHTML
• C_drImage
• C_drPDF
• C_drRTF
• C_drXLS sFileName The filename of the file to create.
Description: Exports the report in the chosen format to the chosen filename.
At the beginning of the routine the OnExportReport event is fired. Export can be
stopped by setting pbCanceled to true in that event.
Sends the Popup message to the object-id stored in the phoStatusPanel property
if pbShowStatusPanel is true.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 88 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
The corresponding export format options need to be set using one of the properties:
pCSVExportOptions, pHTMLExportOptions, pImageExportOptions,
pPDFExportOptions, pRTFExportOptions or pXLSExportOptions. If the
export structure is missing or incorrectly filled the DataFlex Reports OCX cannot
operate correctly and might crash.
At the end of the method the event OnPostExportReport is fired.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oExportReportButton is a Button Set Label to 'Export Report' Procedure OnClick String sReportId drPDFExportOptions PDFExportOptions Get OpenReport of oReport to sReportId If (sReportId <> '') Begin // set the export options Get DefaultPDFExportOptions of oReport to PDFExportOptions Move 'MyPassword' to PDFExportOptions.sOwnerPassword Move 'UserPassword' to PDFExportOptions.sUserPassword Set pPDFExportOptions of oReport to PDFExportOptions Send ExportReport of oReport C_drPDF 'MyReport.pdf' Send CloseReport Of oReport sReporId End End_Procedure End_Object
3.4.1.5.21. FilterCount
Type: Function
Returns: Integer
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The empty
string can be written as C_USEMAINDRREPORTID.
Description: Returns the number of filters defined in the report. The filters must have been
defined by either the filter expert in the designer or added via AddFilter.
This method cannot be used before the report OCX object is initialized and a report is
openend (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 89 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oShowFilterCountButton is a Button Set Label to 'Count number of filters' Procedure OnClick String sReportId Integer iCount Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get FilterCount of oReport sReportId to iCount Send Info_Box iCount 'Number of filters defined' Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.22. FiltersDefined
Type: Function
Returns: Boolean
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The empty
string can be written as C_USEMAINDRREPORTID.
Description: Returns whether the report or any of the (nested) sub-reports has one or more filters
defined. The filters must have been defined by either the filter expert in the designer
or added via AddFilter.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oShowFiltersDefinedButton is a Button Set Label to 'Are there filters defined?' Procedure OnClick String sReportId sText Boolean bFiltersDefined Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get FiltersDefined of oReport sReportId to bFiltersDefined If (bFiltersDefined) Begin Move 'The report contains filters.' to sText End Else Begin Move 'The report does not contain filters.' to sText End Send Info_Box sText Send CloseReport of oReport sReportId End End_Procedure End_Object
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 90 of 183
z
Business Software for a Changing WorldTM
3.4.1.5.23. FunctionCount
Type: Function
Returns: Integer
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The empty
string can be written as C_USEMAINDRREPORTID.
Description: Returns the number of functions defined in the report. The count returns the count
of the self defined functions.
This method cannot be used before the report OCX object is initialized and a report is
openend (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oShowFunctionCountButton is a Button Set Label to 'Count number of functions' Procedure OnClick String sReportId Integer iCount Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get FunctionCount of oReport sReportId to iCount Send Info_Box iCount 'Number of functions defined' Send CloseReport of oReport End End_Procedure End_Object
3.4.1.5.24. FunctionIdByName
Type: Function
Returns: Integer
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. sFunctionName Name of the function to locate.
Description: Returns the ID of a function defined in the report based on the passed function
name.
The test is case insensitive and returns -1 (negative 1) when no function with the
passed name can be found.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 91 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oShowFunctionIDButton is a Button Set Label to 'ID of Function2' Procedure OnClick String sReportId Integer iFunctionId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get FunctionIdByName of oReport sReportId 'Function2' ; to iCount Send Info_Box ('FunctionID =' * String(iFunctionID)) Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.25. FunctionLength
Type: Function
Returns: Integer
Arguments: Argument Description sFunction Content of the function to analyze.
Description: Analyzes the function content and returns the theoretical length of the function's
return value. The result depends on the datatype of the passed function, which can
be found using the FunctionType method.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 92 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oShowFunctionReturnTypeButton is a Button Set Label to 'Return type of Function0' Function BuildReturnTypeString Integer iType Integer iLength String sResult Case Begin Case (iType = SQL_CHAR) Move 'char' to sResult Case Break Case (iType = SQL_NUMERIC) Move 'number' to sResult Case Break Case (iType = SQL_INTEGER) Move 'integer' to sResult Case Break Case (iType = SQL_DOUBLE) Move 'double' to sResult Case Break Case (iType = SQL_DATETIME) Move 'datetime' to sResult Case Break Case Else Move 'unknown' to sResult Case Break Case End Move (sResult * '[' + String(iLength) + ']') to sResult Function_Return sResult End_Function Procedure OnClick String sReportId sFunctionContent sText Integer iLength iType Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get psFunction of oReport sReportId 'Function0' ; to sFunctionContent Get FunctionType of oReport sFunctionContent to iType Get FunctionLength of oReport sFunctionContent to iLength Get BuildReturnTypeString iType iLength to sText Send Info_Box ('Function0 returns' * sText) Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.26. FunctionType
Type: Function
Returns: Integer, representing one of the following data types: • SQL_CHAR
• SQL_DATETIME
• SQL_DOUBLE
• SQL_INTEGER
• SQL_NUMERIC
Arguments: Argument Description sFunction Content of the function to analyze.
Description: Analyzes the function content and returns the data type of the function's return
value. The theoretical length of the return value can be found using the
FunctionLength method.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 93 of 183
z
Business Software for a Changing WorldTM
Type: Function
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oShowFunctionReturnTypeButton is a Button Set Label to 'Return type of Function1' Function BuildReturnTypeString Integer iType String sResult Case Begin Case (iType = SQL_CHAR) Move 'char' to sResult Case Break Case (iType = SQL_NUMERIC) Move 'number' to sResult Case Break Case (iType = SQL_INTEGER) Move 'integer' to sResult Case Break Case (iType = SQL_DOUBLE) Move 'double' to sResult Case Break Case (iType = SQL_DATETIME) Move 'datetime' to sResult Case Break Case Else Move 'unknown' to sResult Case Break Case End Function_Return sResult End_Function Procedure OnClick String sReportId sFunctionContent sText Integer iType Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get psFunction of oReport sReportId 'Function1' ; to sFunctionContent Get FunctionType of oReport sFunctionContent to iType Get BuildReturnTypeString iType to sText Send Info_Box ('Function1 returns' * sText) Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.27. HTMLPreviewData
Type: Function
Returns: String[]
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. iBlockSize The maximum size of each element in the resulting array.
This must be smaller than the maximum argument size
(Get_Argument_Size).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 94 of 183
z
Business Software for a Changing WorldTM
Type: Function
Description: Returns a HTML based report export in an array of string values. The number of
array elements equals the full HTML report size divided by the iBlockSize parameter.
The function is designed to be used together with the previewer class for a DataFlex
17.1 (or higher) web project.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
The GenerateReportHTML function below illustrating the use of
HTMLPreviewData is not needed in an object of the cWebDRReport class. The
example below uses the cDRReport class.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Function GenerateReportHTML Returns String[] String sReportId String[] sData Integer iArgSize Get OpenReport to sReportId If (sReportId <> "") Begin Get_Argument_Size to iArgSize Get HTMLPreviewData sReportId (iArgSize - 10) to sData Send CloseReport sReportId End Function_Return sData End_Function End_Object Object oWebMainPanel is a cWebPanel Set pbFillHeight to True Object oViewer is a cWebDRReportViewer Set phoReport to oReport End_Object End_Object Object oRunReportButton is a cWebButton Set Label to 'Function type of Function0' Procedure OnClick Send ShowReport of oViewer End_Procedure End_Object
3.4.1.5.28. IsFileList
Type: Function
Returns: Boolean
Arguments: Argument Description sFileName Name of the file that is being tested being the filelist or not.
Description: This function can be overridden by a developer. This event is sent during the
OpenReport method when pbAutoLocateDFFiles is set to true.
By default the function returns true when the file extension of the passed filename is
cfg. If the workspace uses a filelist that does not have the cfg extension or has a
complete different name this function can be overridden to return true for the
workspace situation.
Do not write a function that returns true if the file is not a DataFlex filelist.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 95 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Function IsFileList String sFileName Returns Boolean If (sFilename Contains 'TableOfFiles') Begin Function_Return True End End_Function End_Object
3.4.1.5.29. OCXVersion
Type: Function
Returns: String
Arguments: -
Description: This function returns the version number of the loaded DataFlex Reports OCX. The
version number is formatted in the format "<major>.<minor>.<release>.<build>".
The first part (major and minor number) can be compared with the constant
C_DR_OCX_VERSION.
This method cannot be used before the report OCX object is initialized. This is usually
done inside the OpenReport method.
The example dynamically creates a cDRReport object and after calling the
OCXVersion function the object is destroyed again.
Sample: Object oOCXVersionMenuItem is a cCJMenuItem Set psCaption to "OCX Version" Set psTooltip to "OCX Version" Procedure OnExecute Variant vCommandBarControl Handle hoReport String sVersion Get Create (RefClass(cDRReport)) to hoReport Send CreateComObject of hoReport Get OCXVersion of hoReport to sVersion Send ReleaseComObject of hoReport Send Info_Box ("OCX: " + C_DR_OCX_NAME + "version is:" + ; sVersion + "\ncDRReport.Pkg is for OCX version: " + ; C_DR_OCX_VERSION) "Versions" Send Destroy of hoReport End_Procedure End_Object
3.4.1.5.30. OpenReport
Type: Function
Returns: String
Arguments: -
Description: Attempts to open the report specified in the psReportName property.
First a test is done to see if a filename stored in the psReportName property
contains a path and exists. If the file does not exist psReportPath is taken to see if
the file can be found. If no file can be found and DataFlex 17.1 (or later) is used the
ReportsFolder method is called and the value is tested. For DataFlex 17.0 or
before or if the report cannot be found yet the psDataPath of the application
workspace object will be queried to find the report.
If the report cannot be found you will receive an error.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 96 of 183
z
Business Software for a Changing WorldTM
Type: Function
When the property psReportId contains a value the class attempts to close a
report – via CloseReport – with that value as ID.
OpenReport can be used directly by your code and it will also be called when
RunReport is executed. When OpenReport is successful the report is opened and
the return value is the report id, which is also automatically stored in the property
psReportId.
The OnInitializeReport event is called during OpenReport. This event can be
used to set additional properties like psFilterFunction or psFunction.
In a windows application; If pbShowStatusPanel is true and phoStatusPanel
contains an object id, a popup message is sent to the status panel object. This
statuspanel can be used this to inform the user about to the report's loading
progress.
The property pbCanceled can be used to abort the loading or running of the report.
The OpenReport method creates a COM instance of the report viewer, when the
COM module is not properly registered an error will be generated.
If the datasource is the DataFlex embedded database and the property
pbAutoLocateDFFiles is set to true the class attempts to change paths of the
tables, and database.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set peOutputDestination to PRINT_TO_FILE End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Send Info_Box 'We have successfully opened a report' Send OutputReport Of oReport Send CloseReport Of oReport sReportId End End_Procedure End_Object
3.4.1.5.31. OutputReport
Type: Procedure
Returns: -
Arguments: -
Description: Outputs the report; peOutputDestination determines where to send the report
to. The method either calls DisplayReport, PrintReport or ExportReport.
When ExportReport is used the properties peExportType and
psExportFileName need to have valid values else an error will be generated.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 97 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
When the output destination is PRINT_TO_PRINTER the phPrintDlg property can be
set. The content of this property is then passed to the PrintReport method and
should contain the address of a PrintDlgEx structure.
Instead of specifying the address of a PrintDlgEx structure you can specify the
name of the printer via psPrinterName. The output destination can also be set to
PRINT_TO_PRINTER_NO_DIALOG which causes the output to be sent to the default
printer.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set peOutputDestination to PRINT_TO_PRINTER_NO_DIALOG End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Send OutputReport Of oReport Send CloseReport Of oReport sReportId End End_Procedure End_Object
3.4.1.5.32. PaperOrientation
Type: Function
Returns: Integer
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID.
Description: Retrieves the paper orientation of the report. The possible values are
DMORIENT_PORTRAIT and DMORIENT_LANDSCAPE. These constants are defined in
cPrintDialog.h.pkg.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 98 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oPrintReportButton is a Button Set Label to 'Print Report' Procedure OnClick String sReportId Integer eOrientation iResult Handle hPrintDlg hoPrintDialog Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get PaperOrientation Of oReport sReportId to eOrientation Get phoPrintDialog Of oReport to hoPrintDialog Set peOrientation of hoPrintDialog to eOrientation Get PrintDialog of hoPrintDialog to iResult If (iResult = PD_RESULT_PRINT) Begin Get phPrintDlg of hoPrintDialog to hPrintDlg Send PrintReport Of oReport hPrintDlg End End End_Procedure End_Object
3.4.1.5.33. PaperSize
Type: Function
Returns: Integer
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID.
Description: Retrieves the paper size definition of the report. The possible values are defined in
cPrintDialog.h.pkg and all start with DMPAPER_. As example: DMPAPER_A4 or
DMPAPER_LETTER.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 99 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oPrintReportButton is a Button Set Label to 'Print Report' Procedure OnClick String sReportId Integer eSize iResult Handle hPrintDlg hoPrintDialog Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get PaperSize Of oReport sReportId to eSize Get phoPrintDialog Of oReport to hoPrintDialog Set pePaperSize of hoPrintDialog to eSize Get PrintDialog of hoPrintDialog to iResult If (iResult = PD_RESULT_PRINT) Begin Get phPrintDlg of hoPrintDialog to hPrintDlg Send PrintReport Of oReport hPrintDlg End End End_Procedure End_Object
3.4.1.5.34. ParameterCount
Type: Function
Returns: Integer
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID.
Description: Returns the number of parameters for a (sub)report which uses a stored procedure
as the datasource or a report that defines user parameters. You can test if the report
is based on a stored procedure with ReportUsesStoredProcedures.
If the report does not contain parameters the return value is zero.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 100 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Set peOutputDestination to PRINT_TO_PRINTER End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Integer iParameters iParameter String sReportId sName sValue Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get ParameterCount of oReport sReportId to iParameters Decrement iParameters For iParameter from 0 to iParameters // Show name and current value of the parameter Get ParameterName of oReport sReportId iParameter ; to sName Get psParameterValue of oReport sReportId iParameter ; to sValue Get AcceptParameter of oParameterDialog sName sValue ; to sValue Set psParameterValue of oReport sReportId iParameter ; to sValue Loop Send OutputReport of oReport Send CloseReport of oReport End End_Procedure End_Object
3.4.1.5.35. ParameterIdByName
Type: Function
Returns: Integer
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. sParameterName Name of the parameter.
Description: Returns the parameter ID of a parameter whose name is passed.
If you use this function and no parameter with the passed name exists the returned
value is minus one (-1).
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 101 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Integer iParameter String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get ParameterIdByName of oReport sReportId 'Year' ; to iParameter If (iParameter <> -1) Begin Set psParameterValue of oReport sReportId iParameter ; to 1999 End Send OutputReport of oReport Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.36. ParameterInfo
Type: Function
Returns: tDRParameter, see 3.8.9
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. iParameter The N-th parameter if the report's data-source is a stored
procedure, SQL statement or the N-th user defined
parameter..
Description: Returns the name, type, length, and precision of the N-th parameter. Parameters can
be user defined or retrieved from a stored procedure or SQL statement data-source.
The parameter numbering starts at 0.
Attempting to get parameter information for a parameter whose number is outside
the available range (0 – number of parameters, can be retrieved via
ParameterCount) should be avoided.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 102 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oParameterValue is a Form End_Object Object oGetInfoButton is a Button Set Label to 'Parameter Info' Procedure OnClick String sReportId tDRParameter ReportParamInfo Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get ParameterInfo of oReport sReportId 0 to ReportParamInfo Set Label of oParameterValue to ReportParamInfo.Name Send CloseReport of oReport End End_Procedure End_Object
3.4.1.5.37. ParameterName
Type: Function
Returns: String
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. iParameter The N-th parameter if the report's data-source is a stored
procedure, SQL statement or the N-th user defined
parameter..
Description: Returns the name of the N-th parameter. Parameters can be user defined or
retrieved from a stored procedure or SQL statement data-source.
The parameter numbering starts at 0.
An empty string will be returned as the name if parameter is outside the available
range (0 – number of parameters, can be retrieved via ParameterCount).
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 103 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oParameterName is a Form End_Object Object oGetParameterNameButton is a Button Set Label to 'Get Parameter Name' Procedure OnClick String sReportId sName Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get ParameterName of oReport sReportId 0 to sName Set Label of oParameterName to sName Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.38. Parameters
Type: Function
Returns: tDRParameter[], see 3.8.9
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID.
Description: Returns an array of tDRParameter values. Parameters can be user defined or
retrieved from a stored procedure or SQL statement data-source.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 104 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oShowParametersInReportButton is a Button Set Label to 'Show Parameters in Report' Procedure OnClick String sReportId tDRParameter[] ParameterInfo Integer iParameters Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get Parameters of oReport sReportId to ParameterInfo Move (SizeOfArray(ParameterInfo)) to iParameters Decrement iParameters For iParameter from 0 to iParameters Showln ParameterInfo[iParameter].sName Showln ParameterInfo[iParameter].iType Showln ParameterInfo[iParameter].iLength Showln ParameterInfo[iParameter].iPrecision Loop Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.39. ParameterType
Type: Function
Returns: String
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. iParameter The number of the parameter whose type should be
retrieved.
Description: Returns the type of N-th parameter. Parameters can be user defined or retrieved
from a stored procedure or SQL statement data-source.
The parameter numbering starts at 0. An empty string will be returned if the name
parameter whose number is outside the available range (0 – number of parameters)
is requested.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
The return type values are:
Type Data example SQL_BINARY binary data SQL_CHAR "test" SQL_DOUBLE 12.123456 SQL_INTEGER 4 SQL_NUMERIC 2.12 SQL_TYPE_DATE {d '2011-01-16'} SQL_TYPE_TIME {t '09:49:10'}
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 105 of 183
z
Business Software for a Changing WorldTM
Type: Function SQL_TYPE_TIMESTAMP {ts '2011-01-16 09:49:10'} SQL_UNKNOWN_TYPE
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oGetParameterTypeButton is a Button Set Label to 'Get Parameter Type' Procedure OnClick String sReportId Integer iType Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get ParameterType of oReport sReportId 0 to iType Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.40. PreviewFind
Type: Procedure
Returns: -
Arguments: Argument Description sText The text to search for. bDown Search direction; true for downwards, false for upwards. bWholeWord True to ignore occurrences of sText where it is part of a
word, false when occurrences within larger words are also
desired. bMatchCase True for case-sensitive search, false otherwise.
Description: Attempts to find the text in sText using the bDown value for the find direction, the
bWholeWord for focus on whole words only and bMatchCase for case sensitive finds. If
a text was found the page will show and the text is indicated by a red colored
rectangle.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 106 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Send RunReport of oReport End_Procedure End_Object Object oTextForm is a Form Set Label to 'Search:' Set Location to 5 50 End_Object Object oDownCheckbox is a Checkbox Set Location to 20 50 Set Label to 'Down' End_Object Object oWholeWordCheckbox is a Checkbox Set Location to 35 50 Set Label to 'Whole Word' End_Object Object oMatchCaseCheckbox is a Checkbox Set Location to 40 50 Set Label to 'Match Case' End_Object Object oFindButton is a Button Set Label to 'Find' Procedure OnClick String sText Boolean bDown bWholeWord bMatchCase Get Value Of oTextForm to sText Get Checked_State of oDownCheckbox to bDown Get Checked_State of oWholeWordCheckbox to bWholeWord Get Checked_State of oMatchCaseCheckbox to bMatchCase Send PreviewFind of oReport sText bDown bWholeWord bMatchCase End_Procedure End_Object
3.4.1.5.41. PreviewFirstPage
Type: Procedure
Returns: -
Arguments: -
Description: Previews the first report page. This method does nothing if pbHasErrors and
pbCancelIfError are true.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 107 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Send RunReport of oReport End_Procedure End_Object Object oFirstPageButton is a Button Set Label to 'First Page' Procedure OnClick Send PreviewFirstPage of oReport End_Procedure End_Object
3.4.1.5.42. PreviewLastPage
Type: Procedure
Returns: -
Arguments: -
Description: Previews the last report page. This method does nothing if pbHasErrors and
pbCancelIfError are true.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Send RunReport of oReport End_Procedure End_Object Object oLastPageButton is a Button Set Label to 'Last Page' Procedure OnClick Send PreviewLastPage of oReport End_Procedure End_Object
3.4.1.5.43. PreviewNextPage
Type: Procedure
Returns: -
Arguments: -
Description: Previews the next report page, if available. This method does nothing if pbHasErrors
and pbCancelIfError are true.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 108 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Send RunReport of oReport End_Procedure End_Object Object oNextPageButton is a Button Set Label to 'Next Page' Procedure OnClick Send PreviewNextPage of oReport End_Procedure End_Object
3.4.1.5.44. PreviewPreviousPage
Type: Procedure
Returns: -
Arguments: -
Description: Previews the previous report page, if available. This method does nothing if
pbHasErrors and pbCancelIfError are true.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Send RunReport of oReport End_Procedure End_Object Object oPreviousPageButton is a Button Set Label to 'Previous Page' Procedure OnClick Send PreviewPreviousPage of oReport End_Procedure End_Object
3.4.1.5.45. PrintReport
Type: Procedure
Returns: -
Arguments: Argument Description hPrintDlg A handle to a PrintDlgEx structure or zero.
Description: Prints the report in accordance with the report output destination settings.
When a zero is passed as argument, the class pops up a printer selection dialog. The
argument should contain a handle to a PrintDlgEx structure if no dialog should be
opened. Alternatively the psPrinterName can be set to a valid printer name or the
peOutputDestination can be set to PRINT_TO_PRINTER_NO_DIALOG.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 109 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
The OnPrintReport event is fired at the beginning of the print. The print can be
cancelled by setting pbCanceled to true. In the routine the address of the
PRINTDLGEX structure can be changed/set as well.
Sends Popup to the object whose ID is stored in phoStatusPanel if the property
pbShowStatusPanel is set to True. The Popup message is sent to the object
before the COM message is sent. The popup is removed when the COM message has
finished.
At the end of the method the event OnPostPrintReport is fired.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Get OpenReport to sReportId // Prints the report, not passing a valid // printer device context handle Send PrintReport of oReport 0 End_Procedure End_Object Object oPrintReportToDefaultPrinterButton is a Button Set Label to 'Print Report' Procedure OnClick String sReportId Get OpenReport To sReportId Set peOutputDestination of oReport to PRINT_TO_PRINTER_NO_DIALOG Send PrintReport Of oReport 0 End_Procedure End_Object
3.4.1.5.46. PrintToDefaultPrinter
Type: Procedure
Returns: -
Arguments: -
Description: Prints the report, without opening a printer selection dialog, to the default printer
defined at this machine.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 110 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oPrintReportButton is a Button Set Label to 'Print Report' Procedure OnClick String sReportId Get OpenReport to sReportId Send PrintToDefaultReport of oReport End_Procedure End_Object
3.4.1.5.47. RDSTableNames
Type: Function
Returns: tDRTableName[], see 3.8.8
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID.
Description: Returns all the Runtime Data Source tables defined in the report whose ID is passed.
The result is an array with the report IDs, tablenames and tablenumbers.
This is an advanced method used by code generated by the integration wizard to
make it easier to discover all the RDS table names in a report.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 111 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure OnInitializeReport Send LoadRDSData sReportId 0 End_Procedure Procedure LoadRDSData String sReportId Integer iLevel Variant[][] vData Integer iElements iElement iSubReports iSubReport tDRTableName[] TableNames String sSubReportId Get RDSTableNames sReportId to TableNames Move (SizeOfArray(TableNames)) to iElements If (iElements > 0) Begin Decrement iElements For iElement from 0 to iElements Get AddRDSData TableNames[iElement].sTableName iLevel ; to vData Send TableData sReportId TableNames[iElement].iTable vData Loop End Get SubReportCount sReportId to iSubReports If (iSubReports > 0) Begin Decrement iSubReports For iSubReport from 0 to iSubReports Get SubReportId sReportId iSubReport to sSubReportId Send LoadRDSData sSubReportId (iLevel + 1) Loop End End_Procedure
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 112 of 183
z
Business Software for a Changing WorldTM
Type: Function
Function AddRDSCustomerData Returns Variant[][] Integer iRow Variant[][] vData Send Clear of oCustomer_DD Send Request_Read of oCustomer_DD GT Customer.File_Number 1 While (Found) Move Customer.Customer_Number to vData[iRow][0] Move (Trim(Customer.Name)) to vData[iRow][1] Increment iRow Send Locate_Next of oCustomer_DD Loop Function_Return vData End_Function Function AddRDSOrderHeaderData Returns Variant[][] Integer iRow Variant[][] vData Send Clear of oOrderHea_DD Send Request_Read of oOrderHea_DD GT OrderHea.File_Number 1 While (Found) Move OrderHea.Customer_Number to vData[iRow][0] Move OrderHea.Order_Number to vData[iRow][1] Move OrderHea.Order_Total to vData[iRow][2] Move OrderHea.Order_Date to vData[iRow][3] Increment iRow Send Locate_Next of oOrderHea_DD Loop Function_Return vData End_Function Function AddRDSData String sTableName Integer iLevel ; Returns Variant[][] Variant[][] vData Case Begin Case (iLevel = 0 and sTableName = "Customer") Get AddRDSCustomerData to vData Case Break Case (iLevel = 1 and sTableName = "Orders") Get AddRDSOrderHeaderData to vData Case Break Case End Function_Return vData End_Function End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Send RunReport Of oReport End_Procedure End_Object
3.4.1.5.48. RecordSortCount
Type: Function
Returns: Integer
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 113 of 183
z
Business Software for a Changing WorldTM
Type: Function
Description: Returns the number of record sort fields defined in the report. The record sort fields
are added to the report in the designer by the record sort expert and via the
programming language via AddRecordSortField.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oShowRecordSortCountButton is a Button Set Label to 'Show Record Sort Count' Procedure OnClick String sReportId Integer iCount Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get RecordSortCount of oReport sReportId to iCount Send Info_Box iCount 'Number of record sorts defined' Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.49. RefreshReport
Type: Procedure
Returns: -
Arguments: -
Description: Refreshes the report by reading the data and formatting the pages. Sends
DisplayStatusPanel and OnDefineFilters.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Send RunReport of oReport End_Procedure End_Object Object oRefreshReportButton is a Button Set Label to 'Refresh Report' Procedure OnClick Send RefreshReport of oReport End_Procedure End_Object
3.4.1.5.50. RemoveAllFilters
Type: Procedure
Returns: -
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 114 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID.
Description: Removes all the filters defined by the filter expert or added via AddFilter from the
report.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin // Removes all predefined filters, if any Send RemoveAllFilters Of oReport sReportId Send OutputReport of oReport Send CloseReport Of oReport sReportId End End_Procedure End_Object
3.4.1.5.51. RemoveAllRecordSortFields
Type: Procedure
Returns: -
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID.
Description: Removes all the record sort fields defined by the record sort expert or added via
AddRecordSortField from the report.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 115 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin // Remove all the predefined record sorts, if any Send RemoveAllRecordSortFields Of oReport sReportId Send OutputReport of oReport Send CloseReport Of oReport sReportId End End_Procedure End_Object
3.4.1.5.52. RemoveFilter
Type: Function
Returns: Boolean
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of a
sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. iFilter The N-th filter defined in the report.
Description: Removes the passed filter number from the filters defined by the filter expert or
added via AddFilter from the report. Filters start counting from 0.
The function returns true when the action was successful.
If a filter number that does not exist get passed the action will be ignored, no error
will be given.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Boolean bDone String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get RemoveFilter Of oReport sReportId 0 to bDone Send OutputReport of oReport Send CloseReport Of oReport sReportId End End_Procedure End_Object
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 116 of 183
z
Business Software for a Changing WorldTM
3.4.1.5.53. RemoveRecordSortField
Type: Function
Returns: Boolean
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of
a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. iSortFieldIndex The N-th record sort field defined in the report.
Description: Removes the passed record sort from the record sorts defined by the record sort
expert or added via AddRecordSortField from the report. Sort fields start
counting from 0.
The function returns true if the operation was successful.
If a sort field index number is passed that does not exist the action will be ignored,
no error will be given.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Boolean bDone String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get RemoveRecordSortField Of oReport sReportId 0 to bDone Send OutputReport of oReport Send CloseReport Of oReport sReportId End End_Procedure End_Object
3.4.1.5.54. ReportCacheFileName
Type: Function
Returns: String
Arguments: Argument Description sExtension Filename extension for the cache filename to generate.
Description: This function creates a filename based on a UUID (Universially Unique IDentifier) and
the passed extension. No file is generated.
The function uses the DataFlex RandomHexUUID function and the
ReportsCacheFolder for the path.
This function is only available for DataFlex 17.1 and higher and designed to be used
with the Web Application Framework.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 117 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId sFileName drPDFExportOptions PDFReportOptions Get OpenReport of oReport to sReportId If (sReportId <> "") Begin Get DefaultPDFExportOptions of oReport to PDFReportOptions Set pPDFExportOptions of oReport to PDFReportOptions Get ReportCacheFileName of oReport '.pdf' to sFileName If (sFileName <> "") Begin Send ExportReport of oReport C_drPDF sFileName End Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.55. ReportIdForFunction
Type: Function
Returns: tReportFunctionId, see 3.8.7
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of
a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. sFunctionName Name of the function to find.
Description: Uses FunctionIdByName for the passed report identifier and to that extent is
identical, but additionally if the report does not have a function with the passed
function name all the sub reports of the report are iterated and the sub reports of
the sub reports.
The return value is a struct in which the (sub) report id and the function's ordinal
number are returned.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 118 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to "customer with subreport.dr" Procedure OnInitializeReport String sReportId tReportFunctionId FunctionLocation Get psReportId to sReportId Get ReportIdForFunction sReportId "customernumber" to ; FunctionLocation If (FunctionLocation.iFunction <> -1) Begin Set psFunction FunctionLocation.sReportId "customernumber" ; to "return ('{customer.number}=100')" End End_Procedure End_Object
3.4.1.5.56. ReportIdsForFunction
Type: Function
Returns: tReportFunctionId[], see 3.8.7
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of
a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. sFunctionName Name of the function to find.
Description: Enumerates the report and all of its sub-reports and returns an array of report IDs
that contain the function whose name is passed.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to "customer with subreport.dr" Procedure OnInitializeReport Integer iElements iElement String sReportId tReportFunctionId[] FunctionLocations Get psReportId to sReportId Get ReportIdsForFunction sReportId "customernumber" to ; FunctionLocations Move (SizeOfArray(FunctionLocations)) To iElements Decrement iElements For iElement From 0 to iElements Set psFunction FunctionLocations[iElement].sReportId ; "customernumber" to "return ('{customer.number}=100')" Loop End_Procedure End_Object
3.4.1.5.57. ReportIdsForParameter
Type: Function
Returns: tReportParameterId[], see 3.8.10
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 119 of 183
z
Business Software for a Changing WorldTM
Type: Function
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of
a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. sParameterName Name of the parameter to find.
Description: Enumerates the report and all of its sub-reports and returns an array of report IDs
that contain the parameter whose name is passed.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to "customer with subreport.dr" Procedure OnInitializeReport Integer iElements iElement String sReportId tReportParameterId[] ParameterLocations Get psReportId to sReportId Get ReportIdsForParameter sReportId "customernumber" to ; ParameterLocations Move (SizeOfArray(ParameterLocations)) To iElements Decrement iElements For iElement From 0 to iElements Set psParameterValue ParameterLocations[iElement].sReportId ; "customernumber" to 101 Loop End_Procedure End_Object
3.4.1.5.58. ReportPageCount
Type: Function
Returns: Integer
Arguments: -
Description: Returns the number of pages in the report.
Note: If at the time of execution of the function the last page has not been
determined then all pages will be formatted to determine the result.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 120 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oTotalPagesForm is a Form Set Label to 'Total Pages:' Set Enabled_State to False Set Form_Datatype to 0 End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Integer iPageCount Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get ReportPageCount of oReport to iPageCount Set Value of oTotalPagesForm to iPageCount End End_Procedure End_Object
3.4.1.5.59. ReportQuery
Type: Function
Returns: String
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of
a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID.
Description: Returns the ODBC SQL query instruction sent by the report to the ODBC connection.
Will generate an error when the result of the function call DatabaseType is not
C_drODBC or C_drSP.
This method cannot be used before the report OCX object is initialized, a report is
opened (OpenReport) and executed.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sQuery sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Send OutputReport of oReport Get ReportQuery of oReport sReportId to sQuery Send Info_Box sQuery "Report Query" End End_Procedure End_Object
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 121 of 183
z
Business Software for a Changing WorldTM
3.4.1.5.60. ReportsCacheFolder
Type: Function
Returns: String
Arguments: -
Description: This function returns the default reports cache folder location. The default folder is a
folder named Cache in the Reports folder (e.g. c:\examples\weborder\reports\cache).
The function uses the ReportsFolder function and is used by the
ReportCacheFileName function.
An empty string is returned if there is not such folder or there is no cApplication
object.
This function is only available for DataFlex 17.1 and higher and designed to be used
with the Web Application Framework.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Function ReportsCacheFolder Returns String Function_Return 'c:\tmp' End_Function End_Object Send RegisterDownloadFolder of ghoWebResourceManager 'c:\tmp' Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId sFileName drPDFExportOptions PDFReportOptions Get OpenReport of oReport to sReportId If (sReportId <> "") Begin Get DefaultPDFExportOptions of oReport to PDFReportOptions Set pPDFExportOptions of oReport to PDFReportOptions Get ReportCacheFileName of oReport '.pdf' to sFileName If (sFileName <> "") Begin Send ExportReport of oReport C_drPDF sFileName End Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.61. ReportsFolder
Type: Function
Returns: String
Arguments: -
Description: This function returns the default reports folder location. The default folder is a folder
named Reports in the workspace root folder (e.g. c:\examples\weborder\reports).
The function is used by the ReportCacheFolder function and indirect by the
ReportCacheFileName function.
An empty string is returned if there is no such folder or there is no cApplication
object.
This function is only available for DataFlex 17.1 and higher and designed to be used
with the Web Application Framework.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 122 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId sFileName drPDFExportOptions PDFReportOptions Get OpenReport of oReport to sReportId If (sReportId <> "") Begin Get DefaultPDFExportOptions of oReport to PDFReportOptions Set pPDFExportOptions of oReport to PDFReportOptions Get ReportCacheFileName of oReport '.pdf' to sFileName If (sFileName <> "") Begin Send ExportReport of oReport C_drPDF sFileName End Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.62. ReportUsesODBC
Type: Function
Returns: Boolean
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of
a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID.
Description: Returns true when the data source of the report or any of the (nested) sub reports is
ODBC based. Internally it tests if the result of the function call DatabaseType is
C_drODBC.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 123 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId sConnectionString sServerFromTable String sServerFromReportDatabaseConnection Boolean bUsesODBC Get OpenReport of oReport to sReportId Get ReportUsesODBC of oReport sReportId to bUsesODBC If (bUsesODBC) Begin Get TableConnectionString Orders.File_Number ; to sConnectionString Get ServerFromConnectionString sConnectionString ; to sServerFromTable Get psDatabaseConnection of oReport sReportId ; to sConnectionString Get ServerFromConnectionString sConnectionString ; to sServerFromReportDatabaseConnection Move (Replace (sServerFromReportDatabaseConnection, ; sConnectionString, sServerFromTable)) to sConnectionString Set psDatabaseConnection of oReport sReportId ; to sConnectionString End Send OutputReport of oReport End_Procedure End_Object
3.4.1.5.63. ReportUsesRDS
Type: Function
Returns: Boolean
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of
a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID.
Description: Returns true when the data source of the report or any of the (nested) sub reports is
RDS (Runtime Data Source) based. Internally it tests if the result of the function call
DatabaseType is C_drRDS.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 124 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Boolean bUsesRDS Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get ReportUsesRDS of oReport sReportId to bUsesRDS If (bUsesRDS) Begin Send LoadRDSData End Send OutputReport of oReport Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.64. ReportUsesStoredProcedures
Type: Function
Returns: Boolean
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of
a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID.
Description: Returns true when the data source of the report or any of the (nested) sub reports is
Stored Procedure based. Internally it tests if the result of the function call
DatabaseType is C_drSP.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 125 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Boolean bUsesSP Integer iCustomerId iParameter Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get ReportUsesStoredProcedures of oReport sReportId to bUsesSP If (bUsesSP) Begin Get Value Of oCustomerNumberForm to iCustomerId Get ParameterIdByName sReportId "CustomerId" to iParameter If (iParameter <> -1) Begin Set psParameterValue sReportId iParameter to iCustomerId End End Send OutputReport of oReport Send CloseReport of oReport sReporId End End_Procedure End_Object
3.4.1.5.65. RunReport
Type: Procedure
Returns: -
Arguments: -
Description: Runs the report by first opening the report (OpenReport) and then sending
OutputReport. OutputReport looks at peOutputDestination to find out if
the output should be send to screen, a printer or a disk file.
Property psReportName must be set for this method to function.
Sets the pbHasErrors property to false.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Send RunReport of oReport End_Procedure End_Object
3.4.1.5.66. SetDefaultPreviewerClass
Type: Procedure
Returns: -
Arguments: -
Description: Gets the phcPreviewer property value. If the value is zero it will be set to the
cDRPreview class if the pePreviewStyle is set to C_DRPREVIEW_VIEW and set to the
cDRToolPanelPreview class if the pePreviewStyle is set to
C_DRPREVIEW_TOOLPANEL.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 126 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
The phcPreviewer property is used for MDI style report result and toolpanel
dialogs.
The method is called when the pePreviewStyle property is set and can be
augmented to set a different class.
This method is not available for Web Applications.
Sample: Class cMyOutputDialog is a ModalDialog End_Class Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure SetDefaultPreviewerClass Set phcPreviewer to (RefClass(cMyOutputDialog)) End_Procedure End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick Send RunReport of oReport End_Procedure End_Object
3.4.1.5.67. SubReportCount
Type: Function
Returns: Integer
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of
a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID.
Description: Returns the number of sub-reports in a (sub)report
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oCountSubReportButton is a Button Set Label to 'Count subreports' Procedure OnClick Integer iSubReports String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get SubReportCount of oReport sReportId to iSubReports Send Info_Box (Sformat("Number of Subreports: %1", ; iSubReports)) Send CloseReport of oReport sReportId End End_Procedure End_Object
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 127 of 183
z
Business Software for a Changing WorldTM
3.4.1.5.68. SubReportId
Type: Function
Returns: String
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of
a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. iSubReport The N-th subreport defined.
Description: Returns the ID of the N-th subreport in a (sub)report.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure EnumerateSubReports String sReportId Integer iLevel Integer iSubReports iSubReport String sSubReportId Get SubReportCount sReportId to iSubReports Decrement iSubReports For iSubReport from 0 to iSubReports Get SubReportId sReportId iSubReport to sSubReportId Showln (Repeat ('---', iLevel)) sSubReportId Send EnumerateSubReports sSubReportId (iLevel + 1) Loop End_Procedure End_Object Object oOpenReportButton is a Button Set Label to 'Open Report' Procedure OnClick String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Showln 'Report ID Main Report: ' sReportId Send EnumerateSubReports of oReport sReportId 1 Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.69. SubReportIDByName
Type: Function
Returns: String
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of
a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. sSubReportName The name of a subreport for which the report ID must be
retrieved.
Description: Returns the ID of a sub-report with a given name. Normally this function is called
from the main report, but only when sub-reports in a nested level have the same
name the function call should start with the sub-report level. The ID of the first sub-
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 128 of 183
z
Business Software for a Changing WorldTM
Type: Function
report that will be found with the passed name will be returned. An empty string will
be returned if no sub-report can be found with the passed name.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' Procedure SetParameters String sReportId Get SubReportIDByName C_USEMAINDRREPORTID "Orders Subreport" ; to sReportId Set psParameterValue sReportId 1 to 'Y' End_Procedure End_Object Object oOpenReportButton is a Button Set Label to 'Open Report' Procedure OnClick String sReportId Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Send SetParameters of oReport Send OutputReport of oReport Send CloseReport of oReport sReportId End End_Procedure End_Object
3.4.1.5.70. TableCount
Type: Function
Returns: Integer
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of
a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID.
Description: Returns the number of tables in the report.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 129 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oShowTableNamesButton is a Button Set Label to 'Show table names' Procedure OnClick Integer iTables iTable String sReportId sTableName Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get TableCount of oReport sReportId to iTables Decrement iTables For iTable From 0 To iTables Get psTableName of oReport sReportId iTable to sTableName Showln 'Table ' iTable ': ' sTableName End Send CloseReport Of oReport sReportId End End_Procedure End_Object
3.4.1.5.71. TableData
Type: Procedure
Returns: -
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of
a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. iTable The N-th RDS table in the report. Table numbers start at
zero. vTableData A two dimensional array with rows and columns of data
for the report.
Description: Passes the data from the application as the RDS data source to the report.
The 2nd dimension of the array must exactly match the data source description in
the report.
The data type in the 2nd dimension of the array must match with the column
datatype description in the RDS data source. This means that passing a string with
characters where an integer is expected is not possible.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 130 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Variant[][] vData Integer iRowElement Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Send Request_Read of oCustomer_DD FIRST_RECORD ; Customer.File_Number 1 While (Found) Move (Trim(Customer.Name)) to vData[iRowElement][0] Move (Trim(Country.Name)) to vData[iRowElement][1] Increment iRowElement Send Locate_Next of oCustomer_DD Loop Send TableData of oReport sReportId 0 vData Send DisplayReport of oReport End End_Procedure End_Object
3.4.1.5.72. TestFilterFunction
Type: Function
Returns: Boolean
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of
a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID. sFilterFunction The filter function to be checked.
Description: Returns True if the syntax of the function is valid, or false otherwise.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 131 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Boolean bOk String sFilter Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Move 'return ({customer.id} > 0)' to sFilter Get TestFilterFunction Of oReport sReportId sFilter to bOk If (bOk) Begin Set psFilterFunction Of oReport sReportId To sFilter End Send DisplayReport Of oReport End End_Procedure End_Object
3.4.1.5.73. TimeToString
Type: Function
Returns: String
Arguments: Argument Description tmValue The time variable to format as a string.
Description: Returns a formatted time value in the format hh:mm:ss. Can be used for parameters
that require a time value.
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId sParameterValue Time tmNow Integer iParameter Get OpenReport of oReport to sReportId If (sReportId <> '') Begin Get ParameterIdByName Of oReport sReportId 'StartTime' ; to iParameter If (iParameter <> -1) Begin Move (CurrentDateTime ()) To tmNow Get TimeToString Of oReport tmNow To sParameterValue Set psParameterValue of oReport sReportId iParameter ; to sParameterValue End Send DisplayReport Of oReport End End_Procedure End_Object
3.4.1.5.74. TotalParameterCount
Type: Function
Returns: Integer
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 132 of 183
z
Business Software for a Changing WorldTM
Type: Function
Arguments: Argument Description sReportId ID of the report. Can be ID of the main report or the ID of
a sub-report.
This argument can be passed as an empty string. The
empty string can be written as C_USEMAINDRREPORTID.
Description: Returns the number of parameters in a report and its optional sub-reports.
This method cannot be used before the report OCX object is initialized and a report is
opened (OpenReport).
Sample: Object oReport is a cDRReport Set psReportName to 'MyReport.dr' End_Object Object oRunReportButton is a Button Set Label to 'Run Report' Procedure OnClick String sReportId Integer iParameters Get OpenReport of oReport to sReportId Get TotalParameterCount Of oReport sReportId to iParameters If (iParameters > 0) Begin // Do something with this knowledge End End_Procedure End_Object
3.4.2. cWebDRReport class
An object of this class is meant for web reporting. While the cDRReport class can be used in the web
the cWebDRReport class contains methods and events specific for the web.
This class is not available in DataFlex versions 17.0 and older.
3.4.2.1. Properties
3.4.2.1.1. peBrowserTarget
Type: Integer
Default: btNewWindow
Arguments: -
Description: Can be set to one of the supported browser target constants supported by the
NavigateToPage method of the web framework.
The possible values are: btNewWindow, btCurrentWindow and btNewTab
Sample: Object oMyReport is a cWebDRReport Set peBrowserTarget to btNewTab End_Object
3.4.2.1.2. peImageType
Type: Integer
Default: C_drJPEG
Arguments: -
Description: Can be set to one of the supported image types for the cWebDRReportViewer class.
The possible values are: C_drJPEG, C_drPNG and C_drGIF.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 133 of 183
z
Business Software for a Changing WorldTM
Type: Integer
The property is used by the GenerateDownloadLinks method.
Sample: Object oMyReport is a cWebDRReport Set peImageType to C_drGIF End_Object
3.4.2.1.3. phoReportViewer
Type: Handle
Default: 0
Arguments: -
Description: Can be set to the object ID of an (web) object that understands the psURL
webproperty interface. If set the property is typically set to an instance of the
cWebIFrame class.
The property is used by the GenerateReport method. The GenerateReport
method creates a PDF document that can be either shown in an iFrame, the current
browser tab, a new browser tab or a new browser window. If the property is not set
the peBrowserTarget is used and passed to the NavigateToPage method of the
web framework.
Sample: Object oMyReport is a cWebDRReport End_Object Object oViewer is a cWebIFrame Set pbFillHeight to True Set pbShowBorder to True Set phoReportViewer of oMyReport to Self End_Object
3.4.2.2. Events
3.4.2.2.1. OnSetPDFExportOptions
Type: Function
Returns: drPDFExportOptions
Arguments: Argument Description PDFExportOptions Contains the PDF Export Options based on the
drPDFExportOptions struct
Description: This event is called from the GenerateReport procedure and function and the
PDFExportOptions argument contains the result of the DefaultPDFExportOptions
function call.
Sample: Object oMyReport is a cWebDRReport Function OnSetPDFExportOptions drPDFExportOptions PDFExportOptions ; Returns drPDFExportOptions Move C_DRHigh to PDFExportOptions.iImageQuality Function_Return PDFExportOptions End_Procedure End_Object
3.4.2.3. Methods
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 134 of 183
z
Business Software for a Changing WorldTM
3.4.2.3.1. ExportFileNamesSet
Type: Function
Returns: String[]
Arguments: Argument Description sExtension Filename extension. Any extension allowed but value is
usually one of the supported export formats (Image: JPG,
GIF, PNG, TIFF, HTML, PDF, CSV, RTF, Excel:XLS, XLSX) iPageNumber 0-number of pages in the report.
Description: Creates an array of unique filenames. The format of the element is
1. Path returned by the ReportsCacheFolder
2. UUID filename in HEX format (e.g. 5A164D47-C4BB-4BA0-851D-
896865D4D613)
3. –Page<PageNumber>
4. .<extension>
If the passed iPageNumber is greater than zero and less than the number of pages in
the report (retrieved via ReportPageCount) the array contains only ONE filename. If
the iPageNumber is zero, less than zero or larger than the page count the array
contains a number of filenames equal to the pagecount of the report.
While the function can be called by developers it is called by the
ExportReportToDownloadURL method and can be augmented to return a different (set)
of filenames.
Sample: Object oMyReport is a cWebDRReport Function ExportFileNamesSet String sExtension Integer iPageNumber ; Returns String[] Integer iPages iPage iElement String sCacheFolder sHEXUUID sBaseName String[] sFileNames Get ReportsCacheFolder to sCacheFolder Get RandomHexUUID to sHEXUUID Move (sCacheFolder + sHEXUUID) to sBaseName Get ReportPageCount to iPages If (iPageNumber > 0 and iPageNumber < iPages) Begin Move (Sformat ("%1-Seite%2.%3", sBaseName, iPageNumber,; sExtension)) to sFileNames[iElement] End Else Begin For iPage from 1 to iPages Move (Sformat ("%1-Seite%2.%3", sBaseName, iPage,; sExtension)) to sFileNames[iElement] Increment iElement Loop End Function_Return sFileNames End_Function End_Object
3.4.2.3.2. ExportReportToDownloadURL
Type: Procedure
Returns: -
Arguments: Argument Description NamedValues An array of tNameValuePair members. The array element
values are used to determine the output and options.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 135 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Description: This method is called from ExportReport.wo but can be used in own code as well.
The method opens the current report and expects the NamedValues array contains at
least two elements (named ExportFormat and AllPages.
The ExportFormat element must be one of: HTML, TIFF, GIF, PNG, JPEG, PDF. CSV,
XLS, XLSX, RTF.
The AllPages element must be true or false.
Sample: Object oExportReportMenuItem is a cWebMenuItem Set psCaption to "Export Report" Set peActionDisplay to adMenu Procedure OnClick Register_Object oExportReportWebView Send NavigateForward of oExportReportWebView Self End_Procedure Procedure OnNavigateBack Handle hoCallback tWebNavigateData ; NavigateData Send ExportReportToDownloadURL of oReport NavigateData.NamedValues End_Procedure End_Object
3.4.2.3.3. GenerateDownloadLinks
Type: Function
Returns: String[]
Arguments: -
Description: Open the report specified in psReportName using the OpenReport method. If successful
the peImageType is used to set the iImageType member of the drImageExportOptions
structure and used for the file extension for a set of export filenames. Each page of
the report is exported into a file and converted in a download link that can be used
by the cWebDRReportViewer class.
Sample: Object oMyReport is a cWebDRReport Set psReportName to "CustomerList.dr" Set peImageType to C_drGIF End_Object Object oViewer is a cWebDRReportViewer Set phoReport to oMyReport Set peMode to C_IMAGEOUTPUT End_Object Object oRunReportButton is a cWebButton Procedure OnClick Send ShowReport of oViewer End_Procedure End_Object
3.4.2.3.4. GenerateReport
Type: Procedure
Returns: -
Arguments: -
Description: First calls the GenerateReport function. If the PDF was generated successfully the
DownloadURL function converts this to a URL that can be used in the web-browser. If
the property phoReportViewer is set the URL is used for the psURL property else the
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 136 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
peBrowserTarget property is used to determine the target value for the web
framework method NavigateToPage.
Sample: Object oMyReport is a cWebDRReport Set psReportName to "CustomerList.dr" Set phoReportViewer to oViewer End_Object Object oViewer is a cWebIframe End_Object Object oRunReportButton is a cWebButton Procedure OnClick Send GenerateReport of oMyReport End_Procedure End_Object
3.4.2.3.5. GenerateReport
Type: Function
Returns: String
Arguments: -
Description: Opens the report using OpenReport. If successful the method loads default PDF
export options using DefaultPDFExportOptions. This struct is passed to
OnSetPDFExportOptions for different settings and passed to the OCX where it is used
by ExportReport. The PDF filename is constructed by ReportCacheFileName. If the
report execution was not cancelled the export filename is passed to the caller.
Sample: Object oMyReport is a cWebDRReport Set psReportName to "CustomerList.dr" End_Object Object oRunReportButton is a cWebButton Procedure OnClick String sPDFFileName Get GenerateReport of oMyReport to sPDFFileName End_Procedure End_Object
3.4.2.3.6. GenerateReportHTML
Type: Function
Returns: String[]
Arguments: -
Description: Opens a report using the OpenReport method then calling the HTMLPreviewData
method passing the current argument size (minus 10 bytes) to get an array of
strings. These strings need to be concatenated and decoded from Base64 to normal
text before it can be used.
The method is called from the ShowReport method defined in the cWebDRReportViewer
class.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 137 of 183
z
Business Software for a Changing WorldTM
Type: Function
Sample: Object oMyReport is a cWebDRReport Set psReportName to “CustomerList.dr” End_Object Object oViewer is a cWebDRReportViewer Set phoReport to oMyReport End_Object Object oRunReport is a cWebButton Procedure OnClick Send ShowReport of oViewer End_Procedure End_Object
3.4.3. cDRSortColumnsGrid class
An object of this class can be used to let the end-user select the order of the detail data in a report.
Selecting "User can select ordering" in combination with "Multi level sort order" in the integration
wizard for Windows applications creates an object of this class.
The column objects can be standard cCJGridColumn class based objects while the sort direction column
is usually based on the cDRSortDirectionsGridColumn class.
The following example lets the end-user select from a couple of columns in the customer table to sort
on.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 138 of 183
z
Business Software for a Changing WorldTM
Object oSortColumnsGrid is a cDRSortColumnsGrid Set Location to 11 5 Set Size to 45 75 Object oSortOnColumnRef is a cCJGridColumn Set pbVisible to False Set pbShowInFieldChooser to False End_Object Object oSortOnColumn is a cCJGridColumn Set psCaption to "Sort On" Set piWidth to 60 Set pbEditable to False End_Object Object oSortDirectionColumn is a cDRSortDirectionsGridColumn Set psCaption to "Direction" Set piWidth to 40 Set psAscendingText to "Ascending" Set psDescendingText to "Descending" End_Object Procedure AddRecordSortFields Handle hoReport tDataSourceRow[] SortColumnsData Handle hoDataSource Integer iElements iElement iSortOnColumn iSortDirectionColumn iDirection Get piColumnId of oSortOnColumnRef to iSortOnColumn Get piColumnId of oSortDirectionColumn to iSortDirectionColumn Get phoDataSource to hoDataSource Get DataSource of hoDataSource to SortColumnsData Move (SizeOfArray(SortColumnsData)) to iElements Decrement iElements for iElement from 0 to iElements Get SortDirection of oSortDirectionColumn ; SortColumnsData[iElement].sValue[iSortDirectionColumn] ; to iDirection Send AddRecordSortField of hoReport C_USEMAINDRREPORTID ; SortColumnsData[iElement].sValue[iSortOnColumn] iDirection Loop End_Procedure
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 139 of 183
z
Business Software for a Changing WorldTM
Procedure AddSortColumn tDataSourceRow[] ByRef SortColumnsData ; String sColumnRef String sColumn String sDirection Integer iColumn iRow Move (SizeOfArray(SortColumnsData)) to iRow Get piColumnId of oSortOnColumnRef to iColumn Move sColumnRef to SortColumnsData[iRow].sValue[iColumn] Get piColumnId of oSortOnColumn to iColumn Move sColumn to SortColumnsData[iRow].sValue[iColumn] Get piColumnId of oSortDirectionColumn to iColumn Move sDirection to SortColumnsData[iRow].sValue[iColumn] End_Procedure Procedure LoadData tDataSourceRow[] data Integer iColumn Send AddSortColumn data "{Customer.CustomerId}" "CustomerId" "Ascending" Send AddSortColumn data "{Customer.CustomerName}" "CustomerName" ; "Ascending" Send AddSortColumn data "{Customer.City}" "City" "Ascending" Send AddSortColumn data "{Customer.Category}" "Category" "Ascending" Send InitializeData data End_Procedure End_Object
3.4.3.1. Properties
The following properties are set for this class. No new properties are defined in this class.
Property Value pbHeaderTogglesDirection True pbAllowColumnRemove False pbAllowAppendRow False pbAllowDeleteRow False pbAllowInsertRow False piFocusCellBackColor clNone piFocusCellForeColor clNone piFocusCellRectangleColor clBlack pbUseFocusCellRectangle False pbSelectionEnable True
3.4.3.2. Events
3.4.3.2.1. Activating
Type: Procedure
Returns: -
Arguments: -
Description: This event sends a LoadData message in which the developer needs to provide the
grid data.
Sample: Object oSortColumnsGrid is a cDRSortColumnsGrid Set Location to 11 5 Set Size to 45 75 Procedure Activating Forward Send Activating Send MoveToFirstRow End_Procedure End_Object
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 140 of 183
z
Business Software for a Changing WorldTM
3.4.3.2.2. LoadData
Type: Procedure
Returns: -
Arguments: -
Description: This event gets called during the activation of the object. The developer should
create an array with tDataSourceRow elements and load the data via the
InitializeData method.
Sample: Object oSortColumnsGrid is a cDRSortColumnsGrid Set Location to 11 5 Set Size to 45 75 Object oSortOnColumnRef is a cCJGridColumn Set pbVisible to False Set pbShowInFieldChooser to False End_Object Object oSortOnColumn is a cCJGridColumn Set psCaption to "Sort On" Set piWidth to 60 Set pbEditable to False End_Object Object oSortDirectionColumn is a cDRSortDirectionsGridColumn Set psCaption to "Direction" Set piWidth to 40 Set psAscendingText to "Ascending" Set psDescendingText to "Descending" End_Object Procedure LoadData tDataSourceRow[] SortColumnsData Integer iColumn Get piColumnId of oSortOnColumnRef to iColumn Move "{Customer.CustomerId}" to SortColumnsData[0].sValue[iColumn] Get piColumnId of oSortOnColumn to iColumn Move "CustomerId" to SortColumnsData[0].sValue[iColumn] Get piColumnId of oSortDirectionColumn to iColumn Move "Ascending" to SortColumnsData[0].sValue[iColumn] Get piColumnId of oSortOnColumnRef to iColumn Move "{Customer.CustomerName}" to ; SortColumnsData[1].sValue[iColumn] Get piColumnId of oSortOnColumn to iColumn Move "CustomerName" to SortColumnsData[1].sValue[iColumn] Get piColumnId of oSortDirectionColumn to iColumn Move "Ascending" to SortColumnsData[1].sValue[iColumn] Get piColumnId of oSortOnColumnRef to iColumn Move "{Customer.City}" to SortColumnsData[2].sValue[iColumn] Get piColumnId of oSortOnColumn to iColumn Move "City" to SortColumnsData[2].sValue[iColumn] Get piColumnId of oSortDirectionColumn to iColumn Move "Ascending" to SortColumnsData[2].sValue[iColumn] Send InitializeData SortColumnsData End_Procedure End_Object
3.4.3.3. Methods
3.4.3.3.1. SwitchRows
Type: Procedure
Returns: -
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 141 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Arguments: Argument Description bUp True to move the currently selected row one position up
(if possible), or false to move it down (if possible).
Description: Makes two rows switch places, effectively moving the one row up and the other one
down.
Sample: Object oMoveUpButton is a Button Set Size to 16 16 Set Location to 18 85 Set Bitmap to "Up16.bmp" Set psToolTip to "Promote in Sort Order" Procedure OnClick Send SwitchRows of oSortColumnsGrid True End_Procedure End_Object
3.4.4. cDRSortDirectionsGridColumn class
An object of this class can be used to let the end-user select the sort direction (ascending or
descending). The class is an extension to the cCJGridColumn class and can only be used in a
cDRSortColumnsGrid instance. Selecting "User can select ordering" in combination with "Multi level sort
order" in the integration wizard for Windows applications creates an object of this class.
The following example shows the usage of the cDRSortDirectionsGridColumn class.
Object oSortColumnsGrid is a cDRSortColumnsGrid Set Location to 11 5 Set Size to 45 75 Object oSortOnColumnRef is a cCJGridColumn Set pbVisible to False Set pbShowInFieldChooser to False End_Object Object oSortOnColumn is a cCJGridColumn Set psCaption to "Sort On" Set piWidth to 60 Set pbEditable to False End_Object Object oSortDirectionColumn is a cDRSortDirectionsGridColumn Set psCaption to "Direction" Set piWidth to 40 Set psAscendingText to "Ascending" Set psDescendingText to "Descending" End_Object End_Object
3.4.4.1. Properties
The following properties are set for this class.
Property Value
pbComboButton True
3.4.4.1.1. psAscendingText
Type: String
Default: "Ascending"
Arguments: -
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 142 of 183
z
Business Software for a Changing WorldTM
Type: String
Description: Users can select between Ascending and Descending. The text is provided via a
property for translation purposes.
Sample: Object oSortDirectionColumn is a cDRSortDirectionsGridColumn Set psCaption to "Direction" Set piWidth to 40 Set psAscendingText to "Aufsteigend" End_Object
3.4.4.1.2. psDescendingText
Type: String
Default: "Descending"
Arguments: -
Description: Users can select between Ascending and Descending. The text is provided via a
property for translation purposes.
Sample: Object oSortDirectionColumn is a cDRSortDirectionsGridColumn Set psCaption to "Direction" Set piWidth to 40 Set psDescendingText to "Absteigend" End_Object
3.4.4.2. Events
3.4.4.2.1. AddComboValues
Type: Procedure
Default: -
Arguments: -
Description: This event started at the end of the object instantiation Is used to add combo items
with the text strings from the properties psAscendingText and psDescendingText.
While it is allowed to code this routine its normal use is to get the values of the
psAscendingText and psDescendingText properties.
Sample: Object oSortDirectionColumn is a cDRSortDirectionsGridColumn Set psCaption to "Direction" Set piWidth to 40 Procedure AddComboValues Send ComboAddItem "Aufsteigend" C_drAscending Send ComboAddItem "Absteigend" C_drDescending End_Procedure End_Object
3.4.4.3. Methods
3.4.4.3.1. SortDirection
Type: Function
Returns: Integer
Arguments: Argument Description sSortDirection A string containing one of the values of the
psAscendingText or psDescendingText
properties
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 143 of 183
z
Business Software for a Changing WorldTM
Type: Function
Description: Searches the psCaption members of the column combo data for the passed sort
direction and returns a tComboItemData iData member if found.
Returns -1 (minus 1) if the passed string cannot be found (should not happen!).
Sample: Object oSortColumnsGrid is a cDRSortColumnsGrid Set Location to 11 5 Set Size to 45 75 Procedure AddRecordSortFields Handle hoReport tDataSourceRow[] SortColumnsData Handle hoDataSource Integer iElements iElement iSortOnColumn Integer iSortDirectionColumn iDirection Get piColumnId of oSortOnColumnRef to iSortOnColumn Get piColumnId of oSortDirectionColumn to iSortDirectionColumn Get phoDataSource to hoDataSource Get DataSource of hoDataSource to SortColumnsData Move (SizeOfArray (SortColumnsData)) to iElements Decrement iElements for iElement from 0 to iElements Get SortDirection of oSortDirectionColumn ; SortColumnsData[iElement].sValue[iSortDirectionColumn] ; to iDirection Send AddRecordSortField of hoReport C_USEMAINDRREPORTID ; SortColumnsData[iElement].sValue[iSortOnColumn] iDirection Loop End_Procedure End_Object
3.4.5. cDRMenuItem class
This class is used for the commandbar objects that are created via an object that is instantiated from
the cDRPreview or cDRToolPanelPreview class. It is also used in the DRModalPreview.dg component.
The following subclasses are defined in the library:
• cDRFirstPageMenuItem
• cDRPreviousPageMenuItem
• cDRCurrentPageMenuItem
• cDRNextPageMenuItem
• cDRLastPageMenuItem
• cDRRefreshMenuItem
• cDRPrintMenuItem
• cDRZoomMenuItem
• cDRExportMenuItem
3.4.5.1. Properties
3.4.5.1.1. phoReport
Type: Handle
Default: -1
Arguments: -
Description: Can be set to the object ID of the cDRReport object defined in the neighborhood of
the commandbar objects in the component.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 144 of 183
z
Business Software for a Changing WorldTM
Type: Handle
If the value of this property is -1 (minus 1) the ReportObject method gets the
phoReport value of a parent object, which is usually the component.
Sample: Object oLastPage is a cDRLastPageMenuItem Set phoReport to (oReport) End_Object
3.4.5.2. Events
3.4.5.2.1. IsEnabled
Type: Function
Default: Boolean
Arguments: -
Description: This event uses the function ReportObject to get the object ID of the cDRReport
object to find out what report object to address. The report is queried for the
psReportId property value. If the property is empty the button should be disabled.
You can overwrite the event if you desire.
Sample: Object oFirstPage is a cDRFirstPageMenuItem Function IsEnabled Returns Boolean Boolean bEnabled Move (IsAdministrator ()) To bEnabled If (not (bEnabled)) Begin Forward Get IsEnabled to bEnabled End Function_Return bEnabled End_Function End_Object
3.4.5.3. Methods
3.4.5.3.1. ReportObject
Type: Function
Default: Handle
Arguments: -
Description: This method returns the cDRReport object id that the commandbar object needs to
talk to.
If phoReport of the menu item object is -1 (minus 1) the function will retrieve
phoReport of a parent object (usually the component).
Sample: If ((iZoomFactor >= 25 and iZoomFactor <= 500) or iZoomFactor = -1 ; or iZoomFactor = -2) Begin Get ReportObject to hoReport Set piPreviewZoom of hoReport to iZoomFactor End
3.4.6. cDRExportMenuItem class
3.4.6.1. Properties
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 145 of 183
z
Business Software for a Changing WorldTM
3.4.6.1.1. phoExportOptionsDialog
Type: Handle
Default: 0
Arguments: -
Description: Must be set to the object ID of an object that handles the export of the report data.
There is a predefined dialog that can be used for this. The predefined dialog can be
found in the DRExportOptions.dg package.
If the property is not set to an object id the menu item does not start an export. Of
course the whole OnExecute method can be overridden.
Sample: Use DRExportOptions.dg Object oExport is a cDRExportMenuItem Set phoExportOptionsDialog to (oDRExportOptionsDialog) End_Object
In the next example the OnExecute is overridden and calls the ExportReport method
directly.
Object oExport is a cDRExportMenuItem Procedure OnExecute Variant vCommandBarControl Handle hoReport drPDFExportOptions PDFExportOptions Get ReportObject to hoReport Move C_drNormal to PDFExportOptions.iPageMode Move 'MyPassword' to PDFExportOptions.sOwnerPassword Move 'UserPassword' to PDFExportOptions.sUserPassword Move C_drLow to PDFExportOptions.iImageQuality Move True to PDFExportOptions.bAllPages Move 1 to PDFExportOptions.iPage Set pPDFExportOptions of hoReport to PDFExportOptions Send ExportReport of hoReport C_drPDF 'MyReport.PDF' End_Procedure End_Object
3.4.7. cDRPreview class
This class is the default class used to create objects when the preview style (pePreviewStyle) is set to
C_DRPREVIEW_VIEW in a cDRReport object. This preview method is the default – and preferred – way
when a reportview object for a Windows application is created (with or without using the integration
wizard).
The class reference is stored in the phcPreviewer property of the cDRReport object if the
pePreviewStyle property is set to C_DRPREVIEW_TOOLPANEL. The setting occurs in the
SetDefaultPreviewerClass method.
An object of this class uses an icon that is loaded from a filename DR.ico. The file is defined in the
library and should be either copied to the workspace (bitmaps folder) or linked as an embedded icon
via the project properties, icon tab-page.
The size of an object of this class is automatically set to the size of the MDI container minus some
space to keep the view show as not maximized.
The property pbAllowMaximizeView of the cDRReport object is used to set the Maximize_Icon property.
3.4.7.1. Child objects
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 146 of 183
z
Business Software for a Changing WorldTM
An object of this class defines a preview window object, a commandbar object and a close button
object.
The toolbar buttons of the commandbar object are all instantiated directly or indirectly from the
cDRMenuItem class. The close button is a normal DataFlex button which sends the Close_Panel
message when clicked. The preview window is an instance of the cDRPreviewWindow class.
3.4.7.2. Properties
3.4.7.2.1. phoReport
Type: Handle
Default: 0
Arguments: -
Description: Needs to be set to the object ID of the cDRReport object. If the cDRPreview object is
created via the DisplayReport method while the pePreviewStyle set to
C_DRPREVIEW_VIEW this property is automatically set to the report object. The
command bar toolbar objects can make use of this property.
In the example code below the phoReport property is retrieved and a message to
navigate to the last page of the report is send to that object ID.
Sample: Procedure PreviewLastPage Handle hoReport Get phoReport to hoReport If (hoReport <> 0) Begin Send PreviewLastPage of hoReport End End_Procedure
3.4.7.3. Events
3.4.7.3.1. OnPageChanged
Type: Procedure
Returns: -
Arguments: Argument Description iPage Holds the current report page number.
Description: This event is sent by an object from the cDRReport class and is used to display the
current page number in the toolbar that is also automatically created by the
cDRPreview class.
Sample: Object oView is a cDRPreview Procedure OnPageChanged Integer iPage Set psText of (oCurrentPage(oDRToolBar(oCommandBars))) ; to (String(iPage)) End_Procedure End_Object
3.4.7.3.2. OnZoomChanged
Type: Procedure
Returns: -
Arguments: Argument Description iFactor The zoom factor.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 147 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Description: This event is sent by an object from the cDRReport class and is used to display the
current page number in the toolbar that is also automatically created by the
cDRPreview class.
The value of iFactor can be one of:
Value Description
25-500 Percentage of the original size.
-1 Zoom to page width.
-2 Zoom to full (whole) page.
Sample: Object oView is a cDRPreview Procedure OnZoomChanged Integer iFactor Set psText of (oZoom(oDRToolBar(oCommandBars))) ; to (String(iFactor) + "%") End_Procedure End_Object
3.4.7.4. Methods
3.4.7.4.1. PreviewFirstPage
Type: Procedure
Returns: -
Arguments: -
Description: This message is sent if the user presses the Ctrl+Home key. By default the message
takes the object id stored in phoReport property and sends the PreviewFirstPage to
that object.
Sample: Procedure PreviewFirstPage Handle hoReport Get phoReport to hoReport If (hoReport <> 0) Begin Send PreviewFirstPage of hoReport End End_Procedure
3.4.7.4.2. PreviewLastPage
Type: Procedure
Returns: -
Arguments: -
Description: This message is sent if the user presses the Ctrl+End key. By default the message
takes the object id stored in phoReport property and sends the PreviewLastPage to
that object.
Sample: Procedure PreviewLastPage Handle hoReport Get phoReport to hoReport If (hoReport <> 0) Begin Send PreviewLastPage of hoReport End End_Procedure
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 148 of 183
z
Business Software for a Changing WorldTM
3.4.7.4.3. PreviewNextPage
Type: Procedure
Returns: -
Arguments: -
Description: This message is sent if the user presses the PageDown key. By default the message
takes the object id stored in phoReport property and sends the PreviewNextPage to
that object.
Sample: Procedure PreviewNextPage Handle hoReport Get phoReport to hoReport If (hoReport <> 0) Begin Send PreviewNextPage of hoReport End End_Procedure
3.4.7.4.4. PreviewPreviousPage
Type: Procedure
Returns: -
Arguments: -
Description: This message is sent if the user presses the PageUp key. By default the message
takes the object id stored in phoReport property and sends the PreviewPreviousPage
to that object.
Sample: Procedure PreviewPreviousPage Handle hoReport Get phoReport to hoReport If (hoReport <> 0) Begin Send PreviewPreviousPage of hoReport End End_Procedure
3.4.8. cDRPreviewWindow class
An object of this class can be used to preview the results of a cDRReport object. The DataFlex Reports
OCX knows where to display the report by passing the window handle of the cDRPreviewWindow.
The class does not contain any public properties, events, or methods other than the ones from its
superclass cWinControl.
An object of this class is created if an object of the cDRPreview or the cDRToolPanelPreview class is
instantiated and is defined in the DRModalPreview.dg component.
Usage:
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 149 of 183
z
Business Software for a Changing WorldTM
Object oDRPreviewer is a cDRPreviewWindow Set Size to 228 602 Set Location to 21 5 Set peAnchors to anAll End_Object
3.4.9. cDRToolPanelPreview class
This class is the default class used to create objects when the preview style (pePreviewStyle) is set to
C_DRPREVIEW_TOOLPANEL in a cDRReport object. This preview method is a solution when the preview
output should be shown on the screen not being modal and not being bound to the size of the MDI
container.
The class reference is stored in the phcPreviewer property of the cDRReport object if the
pePreviewStyle is set to C_DRPREVIEW_TOOLPANEL. The setting occurs in the SetDefaultPreviewerClass
method.
An object of this class uses an icon that is loaded from a filename DR.ico. The file is defined in the
library and should be either copied to the workspace (bitmaps folder) or linked as an embedded icon
via the project properties, icon tab-page.
The size of an object of this class is automatically set to the size of the main panel minus some space
if the main application is maximized.
3.4.9.1. Child objects
An object of this class defines a preview window object, a commandbar object and a close button
object.
The toolbar buttons of the commandbar object are all instantiated directly or indirectly from the
cDRMenuItem class, see paragraph 3.4.5. The close button is a normal DataFlex button which sends the
Close_Panel message when clicked. The preview window is an instance of the cDRPreviewWindow class,
see paragraph 3.4.8.
3.4.9.2. Properties
3.4.9.2.1. phoReport
Type: Handle
Default: 0
Arguments: -
Description: Needs to be set to the object ID of the cDRReport object. If the cDRToolPanelPreview
object is created via the DisplayReport method while the pePreviewStyle set to
C_DRPREVIEW_TOOLPANEL this property is automatically set to the report object. The
command bar toolbar objects can make use of this property.
In the example code below the phoReport property is retrieved and a message to
navigate to the last page of the report is send to that object ID.
Sample: Procedure PreviewLastPage Handle hoReport Get phoReport to hoReport If (hoReport <> 0) Begin Send PreviewLastPage of hoReport End End_Procedure
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 150 of 183
z
Business Software for a Changing WorldTM
3.4.9.3. Events
3.4.9.3.1. OnPageChanged
Type: Procedure
Returns: -
Arguments: Argument Description iPage Holds the current report page number.
Description: This event is sent by an object from the cDRReport class and is used to display the
current page number in the toolbar that is also automatically created by the
cDRToolPanelPreview class.
Sample: Object oView is a cDRToolPanelPreview Procedure OnPageChanged Integer iPage Set psText of (oCurrentPage(oDRToolBar(oCommandBars))) ; to (String(iPage)) End_Procedure End_Object
3.4.9.3.2. OnZoomChanged
Type: Procedure
Returns: -
Arguments: Argument Description iFactor The zoom factor.
Description: This event is sent by an object from the cDRReport class and is used to display the
current page number in the toolbar that is also automatically created by the
cDRToolPanelPreview class.
The value of iFactor can be one of:
Value Description
25-500 Percentage of the original size.
-1 Zoom to page width.
-2 Zoom to full (whole) page.
Sample: Object oView is a cDRToolPanelPreview Procedure OnZoomChanged Integer iFactor Set psText of (oZoom(oDRToolBar(oCommandBars))) ; to (String(iFactor) + "%") End_Procedure End_Object
3.4.9.4. Methods
3.4.9.4.1. PreviewFirstPage
Type: Procedure
Returns: -
Arguments: -
Description: This message is sent if the user presses the Ctrl+Home key. By default the message
takes the object id stored in phoReport property and sends the PreviewFirstPage to
that object.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 151 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Sample: Procedure PreviewFirstPage Handle hoReport Get phoReport to hoReport If (hoReport <> 0) Begin Send PreviewFirstPage of hoReport End End_Procedure
3.4.9.4.2. PreviewLastPage
Type: Procedure
Returns: -
Arguments: -
Description: This message is sent if the user presses the Ctrl+End key. By default the message
takes the object id stored in phoReport property and sends the PreviewLastPage to
that object.
Sample: Procedure PreviewLastPage Handle hoReport Get phoReport to hoReport If (hoReport <> 0) Begin Send PreviewLastPage of hoReport End End_Procedure
3.4.9.4.3. PreviewNextPage
Type: Procedure
Returns: -
Arguments: -
Description: This message is sent if the user presses the PageDown key. By default the message
takes the object id stored in phoReport property and sends the PreviewNextPage to
that object.
Sample: Procedure PreviewNextPage Handle hoReport Get phoReport to hoReport If (hoReport <> 0) Begin Send PreviewNextPage of hoReport End End_Procedure
3.4.9.4.4. PreviewPreviousPage
Type: Procedure
Returns: -
Arguments: -
Description: This message is sent if the user presses the PageUp key. By default the message
takes the object id stored in phoReport property and sends the PreviewPreviousPage
to that object.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 152 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Sample: Procedure PreviewPreviousPage Handle hoReport Get phoReport to hoReport If (hoReport <> 0) Begin Send PreviewPreviousPage of hoReport End End_Procedure
3.4.10. cDRWebSortColumnsGrid class
An object of this class can be used to let the end-user select the order of the detail data in a report.
Selecting "User can select ordering" in combination with "Multi level sort order" in the integration
wizard for Web Applications creates an object of this class.
The column objects can be standard cWebColumn class based objects while the sort direction column is
usually based on the cDRWebSortDirectionColumn class.
This class is not available in DataFlex versions 17.0 and older.
The following example lets the end-user select from a couple of columns in the customer table to sort
on.
Object oSortColumnsGrid is a cDRWebSortColumnsGrid Object oSortOnWebColumn is a cWebColumn Set psCaption to "Sort On" Set pbSortable to False Set piWidth to 90 Set pbEnabled to False End_Object Object oSortDirectionWebColumn is a cDRWebSortDirectionColumn Set psCaption to "Direction" Set pbServerOnChange to True Procedure OnChange String sNewValue String sOldValue Forward Send OnChange sNewValue sOldValue Send ProcessDataSet of oSortColumnsGrid 3 End_Procedure End_Object Procedure OnSetSortColumns tWebRow[] ByRef WebSortColumnRows Move "{Product.Name}" to WebSortColumnRows[0].aRowId Move "Name" to WebSortColumnRows[0].aCells[0].sValue Move C_DRAscending to WebSortColumnRows[0].aCells[1].sValue Move "{Product.ProductNumber}" to WebSortColumnRows[1]. aRowId Move "ProductNumber" to WebSortColumnRows[1].aCells[0].sValue Move C_DRAscending to WebSortColumnRows[1].aCells[1].sValue Move "{Product.ListPrice}" to WebSortColumnRows[2]. aRowId Move "ListPrice" to WebSortColumnRows[2].aCells[0].sValue Move C_DRAscending to WebSortColumnRows[2].aCells[1].sValue Move "{Product.Class}" to WebSortColumnRows[3]. aRowId Move "Class" to WebSortColumnRows[3].aCells[0].sValue Move C_DRAscending to WebSortColumnRows[3].aCells[1].sValue End_Procedure End_Object
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 153 of 183
z
Business Software for a Changing WorldTM
In DataFlex version 17.1 the code should be:
Object oSortColumnsGrid is a cDRWebSortColumnsGrid Object oSortOnWebColumn is a cWebColumn Set psCaption to "Sort On" Set pbSortable to False Set piWidth to 90 Set pbEnabled to False End_Object Object oSortDirectionWebColumn is a cDRWebSortDirectionColumn Set psCaption to "Direction" Set pbServerOnChange to True Procedure OnChange String sNewValue String sOldValue Forward Send OnChange sNewValue sOldValue Send ProcessDataSet of oSortColumnsGrid 3 End_Procedure End_Object Procedure OnSetSortColumns tWebRow[] ByRef WebSortColumnRows Move "{Product.Name}" to WebSortColumnRows[0].aValues[0] Move "Name" to WebSortColumnRows[0].aValues[1] Move C_DRAscending to WebSortColumnRows[0].aValues[2] Move "{Product.ProductNumber}" to WebSortColumnRows[1].aValues[0] Move "ProductNumber" to WebSortColumnRows[1].aValues[1] Move C_DRAscending to WebSortColumnRows[1].aValues[2] Move "{Product.ListPrice}" to WebSortColumnRows[2].aValues[0] Move "ListPrice" to WebSortColumnRows[2].aValues[1] Move C_DRAscending to WebSortColumnRows[2].aValues[2] Move "{Product.Class}" to WebSortColumnRows[3].aValues[0] Move "Class" to WebSortColumnRows[3].aValues[1] Move C_DRAscending to WebSortColumnRows[3].aValues[2] End_Procedure End_Object
3.4.10.1. Properties
The following properties are set for this class.
Property Value
pbDataAware False
peDbGridType gtManual
pbFillHeight True
piSortColumn -1
pbAllowAppendRow False
pbAllowInsertRow False
pbAllowDeleteRow False
3.4.10.1.1. phoSortDirectionColumn
Type: Handle
Default: 0
Arguments: -
Description: Needs to be set to the object ID that contains C_DRAscending and C_DRDescending
values. This is usually an instance of the cDRWebSortDirectionColumn class which
automatically puts its ID in the property.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 154 of 183
z
Business Software for a Changing WorldTM
Type: Handle
Sample: Object oSortDirectionWebColumn is a cDRWebSortDirectionColumn Set psCaption to 'Direction' Set pbServerOnChange to True // German translations Set psAscendingText to 'Aufsteigend' Set psDescendingText to 'Absteigend' Delegate Set phoSortDirectionColumn to Self End_Object
3.4.10.2. Events
3.4.10.2.1. OnSetSortColumns
Type: Procedure
Returns: -
Arguments: Argument Description WebSortColumnRows Type: tWebRow[] ByRef
Description: Needs to be used to provide the data to be displayed in the web grid.
Sample: Object oSortColumnsGrid is a cDRWebSortColumnsGrid Procedure OnSetSortColumns tWebRow[] ByRef WebSortColumnRows Move "{Product.Name}" to WebSortColumnRows[0].sRowId Move "Name" to WebSortColumnRows[0].aCells[0].sValue Move C_DRAscending to WebSortColumnRows[0].aCells[1].sValue Move "{Product.ProductNumber}" to WebSortColumnRows[1]. sRowId Move "ProductNumber" to WebSortColumnRows[1].aCells[0].sValue Move C_DRAscending to WebSortColumnRows[1].aCells[1].sValue Move "{Product.ListPrice}" to WebSortColumnRows[2]. sRowId Move "ListPrice" to WebSortColumnRows[2].aCells[0].sValue Move C_DRAscending to WebSortColumnRows[2].aCells[1].sValue Move "{Product.Class}" to WebSortColumnRows[3]. sRowId Move "Class" to WebSortColumnRows[3].aCells[0].sValue Move C_DRAscending to WebSortColumnRows[3].aCells[1].sValue End_Procedure End_Object
In DataFlex 17.1 this code has to be:
Object oSortColumnsGrid is a cDRWebSortColumnsGrid Procedure OnSetSortColumns tWebRow[] ByRef WebSortColumnRows Move "{Product.Name}" to WebSortColumnRows[0].aValues[0] Move "Name" to WebSortColumnRows[0].aValues[1] Move C_DRAscending to WebSortColumnRows[0].aValues[2] Move "{Product.ProductNumber}" to WebSortColumnRows[1].aValues[0] Move "ProductNumber" to WebSortColumnRows[1].aValues[1] Move C_DRAscending to WebSortColumnRows[1].aValues[2] Move "{Product.ListPrice}" to WebSortColumnRows[2].aValues[0] Move "ListPrice" to WebSortColumnRows[2].aValues[1] Move C_DRAscending to WebSortColumnRows[2].aValues[2] Move "{Product.Class}" to WebSortColumnRows[3].aValues[0] Move "Class" to WebSortColumnRows[3].aValues[1] Move C_DRAscending to WebSortColumnRows[3].aValues[2] End_Procedure End_Object
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 155 of 183
z
Business Software for a Changing WorldTM
3.4.10.3. Methods
3.4.10.3.1. SortColumnSet
Type: Function
Returns: String[][]
Arguments: -
Description: Returns a two dimensional string array containing pairs of sort column name and sort
direction values.
Will be used to Add record sortfields via the cDRReport AddRecordSortField method.
Sample: Object oReport is a cDRReport Procedure SetSortFields String[][2] sSortColumnData Integer iElements iElement Send RemoveAllRecordSortFields C_USEMAINDRREPORTID Get SortColumnSet of oSortColumnsGrid to sSortColumnData Move (SizeOfArray(sSortColumnData)) to iElements Decrement iElements For iElement from 0 to iElements Send AddRecordSortField C_USEMAINDRREPORTID ; sSortColumnData[iElement][0] ; sSortColumnData[iElement][1] Loop End_Procedure End_Object
3.4.11. cDRWebSortDirectionColumn class
An object of this class can be used to let the end-user select the sort direction (ascending or
descending). The class is an extension to the cWebColumnCombo class and can only be used in a
cDRWebSortColumnsGrid instance. Selecting "User can select ordering" in combination with "Multi level
sort order" in the integration wizard for Web applications creates an object of this class.
This class is not available in DataFlex versions 17.0 and older.
Object oSortDirectionWebColumn is a cDRWebSortDirectionColumn Set psCaption to "Direction" Set pbServerOnChange to True Procedure OnChange String sNewValue String sOldValue Forward Send OnChange sNewValue sOldValue Send ProcessDataSet of oSortColumnsGrid 3 End_Procedure End_Object
3.4.11.1. Properties
The following properties are set and defined for this class.
Property Value
pbSortable False
piWidth 60
3.4.11.1.1. psAscendingText
Type: String
Default: "Ascending"
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 156 of 183
z
Business Software for a Changing WorldTM
Type: String
Arguments: -
Description: Users can select between Ascending and Descending. The text is provided via a
property for translation purposes.
Sample: Object oSortDirectionColumn is a cDRWebSortDirectionColumn Set psCaption to "Direction" Set pbServerOnChange to True Set psAscendingText to "Aufsteigend" Procedure OnChange String sNewValue String sOldValue Forward Send OnChange sNewValue sOldValue Send ProcessDataSet of oSortColumnsGrid 3 End_Procedure End_Object
3.4.11.1.2. psDescendingText
Type: String
Default: "Descending"
Arguments: -
Description: Users can select between Ascending and Descending. The text is provided via a
property for translation purposes.
Sample: Object oSortDirectionColumn is a cDRWebSortDirectionColumn Set psCaption to "Direction" Set pbServerOnChange to True Set psDescendingText to "Absteigend" Procedure OnChange String sNewValue String sOldValue Forward Send OnChange sNewValue sOldValue Send ProcessDataSet of oSortColumnsGrid 3 End_Procedure End_Object
3.4.11.2. Events
3.4.11.2.1. OnFill
Type: Procedure
Default: -
Arguments: -
Description: This standard event is augmented to add combo items with the text strings from the
properties psAscendingText and psDescendingText.
While it is allowed to code this routine its normal use is to get the values of the
psAscendingText and psDescendingText properties.
Sample: Object oSortDirectionColumn is a cDRWebSortDirectionColumn Set psCaption to "Direction" Set piWidth to 40 Procedure AddComboValues Send AddComboItem C_drAscending "Aufsteigend" Send AddComboItem C_drDescending "Absteigend" End_Procedure End_Object
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 157 of 183
z
Business Software for a Changing WorldTM
3.4.12. cWebDRReportViewer class
An object of this class can be used to show the result of a HTML or IMAGE (GIF, JPEG) report in a
browser. The class consists of a DataFlex class and a Web control to show the contents.
This class is not available in DataFlex versions 17.0 and older.
The following example shows the usage of the cWebDRReportViewer class.
Object oReport is a cWebDRReport Set psReportName to "Report.dr" End_Object Object oViewer is a cWebDRReportViewer Set phoReport to oReport End_Object Object oShowReportButton is a cWebButton Procedure OnClick Send ShowReport of oViewer End_Procedure End_Object
3.4.12.1. Properties
The following properties are set for this class.
Property Value pbFillHeight True piColumnSpan 0 psJSClass DR.WebReportViewer
3.4.12.1.1. peMode
Type: Integer
Returns: C_HTMLOUTPUT
Arguments: -
Description: Used to tell the control whether the data contains an array of strings with HTML data
or an array of image file names. Can be one of:
• C_HTMLOUTPUT; the previewer shows a HTML string formatted with page elements.
• C_IMAGEOUTPUT; the previewer shows a series of image files.
Sample: Object oReport is a cWebDRReport Set psReportName to "Report.dr" End_Object Object oViewer is a cWebDRReportViewer Set peMode to C_IMAGEOUTPUT Set phoReport to oReport End_Object Object oShowReportButton is a cWebButton Procedure OnClick Send ShowReport of oViewer End_Procedure End_Object
3.4.12.1.2. piPage
Type: Integer
Returns: 0
Arguments: -
Description: Can be set to navigate to a certain page.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 158 of 183
z
Business Software for a Changing WorldTM
Type: Integer
The property is a web synchronized property which means that the WebSet / WebGet
commands need to be used.
Sample: Object oViewer is a cWebDRReportViewer Procedure GoToPage Integer iPage WebSet piPage to iPage End_Procedure End_Object
3.4.12.1.3. piPageCount
Type: Integer
Returns: 0
Arguments: -
Description: This read-only property can be used to determine how many pages are present in
the client (web) control. The page count will be set by Javascript.
The property is a web synchronized property which means that the WebGet command
need to be used.
Sample: Object oViewer is a cWebDRReportViewer Procedure GoToPage Integer iPage Integer iPages WebGet piPageCount to iPages If (iPage <= iPages and iPage >= 1) Begin WebSet piPage to iPage End End_Procedure End_Object
3.4.12.1.4. phoReport
Type: Handle
Default: 0
Arguments: -
Description: This property needs to be set to the object id of a cDRReport object.
Sample: Object oReport is a cWebDRReport Set psReportName to 'MyReport.dr' End_Object Object oViewer is a cWebDRReportViewer Set phoReport to oReport End_Object
3.4.12.1.5. pbServerOnClickActionLink
Type: Boolean
Default: False
Arguments: -
Description: Can be set to true to be able to respond to a click in the preview window. The peMode
must have been set to C_HTMLOutput and code needs to be written for the
OnClickActionLink event.
Report needs to contain hyperlink IDs. The hyperlink ID will be passed as eDataType
in the OnClickActionLink event.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 159 of 183
z
Business Software for a Changing WorldTM
Type: Boolean
Sample: Object oViewer is a cWebDRReportViewer Set phoReport to oReport Set pbServerOnClickActionLink to True Procedure OnClickActionLink String sData Integer eDataType Send ShowEmployee of oSQLEmployeeModalDialog Self sData End_Procedure End_Object
3.4.12.1.6. pbServerOnOpenReport
Type: Boolean
Default: False
Arguments: -
Description: Can be set to true to be able to respond to the opening of a report using the
OnOpenReport event.
Sample: Object oViewer is a cWebDRReportViewer Set phoReport to oReport Set pbServerOnOpenReport to True Procedure OnOpenReport Integer iPages Forward Send OnOpenReport WebGet piPageCount to iPages Send ShowInfoBox iPages End_Procedure End_Object
3.4.12.1.7. pbServerOnPageChange
Type: Boolean
Default: False
Arguments: -
Description: Can be set to true to be able to respond to a page change via the OnPageChange
event.
Sample: Object oViewer is a cWebDRReportViewer Set phoReport to oReport Set pbServerOnPageChange to True Procedure OnPageChange Integer iPage Forward Send OnPageChange WebGet piPage to iPage Send ShowInfoBox iPage End_Procedure End_Object
3.4.12.1.8. pbShowPrintButton
Type: Boolean
Default: True
Arguments: -
Description: To show a print button in the floating tool-bar in the previewer.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 160 of 183
z
Business Software for a Changing WorldTM
Type: Boolean
Sample: Object oViewer is a cWebDRReportViewer Set phoReport to oReport Set pbShowPrintButton to False End_Object
3.4.12.1.9. pbShowToolbar
Type: Boolean
Default: True
Arguments: -
Description: To show a tool-bar in the preview window. The tool-bar can be used to navigate
through the pages, zoom and print.
Sample: Object oViewer is a cWebDRReportViewer Set phoReport to oReport Set pbShowToolbar to False End_Object
3.4.12.1.10. peToolbarAlignment
Type: Integer
Default: C_TBCENTER
Arguments: -
Description: Can be used to determine where the tool-bar should be positioned. By default the
tool-bar shows in the middle of thepreview window.
If the report contains clickable elements it is better to position the tool-bar at the
right or left hand side of the preview window depending on the location of the
clickable values.
Can be one of: • C_TBCENTER
• C_TBLEFT
• C_TBRIGHT
Sample: Object oViewer is a cWebDRReportViewer Set phoReport to oReport Set peToolbarAlignment to C_TBRIGHT End_Object
3.4.12.1.11. piZoom
Type: Integer
Default: 100
Arguments: -
Description: Can be set to a zoom percentage for the preview window. While it can be set at
designtime it is more likely that the property operates as a readonly property and is
set via the tool-bar in the previewer.
Sample: Object oViewer is a cWebDRReportViewer Set phoReport to oReport Set piZoom to 200 End_Object
3.4.12.2. Events
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 161 of 183
z
Business Software for a Changing WorldTM
3.4.12.2.1. OnClickActionLink
Type: Procedure
Default: -
Arguments: Argument Description sData The cell data. eDataType The hyperlink ID.
Description: This event is fired if pbServerOnClickActionLink is set to true and can be used to
respond to a click on an HTML (div) element containing a hyperlink ID.
The hyperlink ID value defined in the report is passed in the eDataType
parameter.The data parameter contains the cell data.
This event can also be handled by the client by setting the
psClientOnClickActionLink property to the name of a client-side event handler. This
does not require pbServerOnClickActionLink to be set.
Sample: Object oViewer is a cWebDRReportViewer Set phoReport to oReport Set pbServerOnClickActionLink to True Procedure OnClickActionLink String sData Integer eDataType Send ShowEmployee of oSQLEmployeeModalDialog Self sData End_Procedure End_Object
3.4.12.2.2. OnOpenReport
Type: Procedure
Default: -
Arguments: -
Description: This event is fired if pbServerOnOpenReport is set to true and can be used to respond
when the report is being opened.
Sample: Object oViewer is a cWebDRReportViewer Set phoReport to oReport Set pbServerOnOpenReport to True Procedure OnOpenReport Integer iPages Forward Send OnOpenReport WebGet piPageCount to iPages Send ShowInfoBox iPages End_Procedure End_Object
3.4.12.2.3. OnPageChange
Type: Procedure
Default: -
Arguments: -
Description: This event is fired if pbServerOnPageChange is set to true and can be used to respond
to changing a page.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 162 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Sample: Object oViewer is a cWebDRReportViewer Set phoReport to oReport Set pbServerOnPageChange to True Procedure OnPageChange Integer iPage Forward Send OnPageChange WebGet piPage to iPage Send ShowInfoBox iPage End_Procedure End_Object
3.4.12.3. Methods
3.4.12.3.1. NextPage
Type: Procedure
Default: -
Arguments: -
Description: Can be used to instruct the control to navigate to the next page. If the current page
is the last page nothing happens. The piPage property will be updated on a
successful page change.
Sample: Object oWebMainPanel is a cWebPanel Set pbFillHeight to True Object oToolBar is a cWebPanel Set peRegion to prTop Set piColumnCount to 4 Object oNextPageButton is a cWebButton Set psCaption to "Next Page" Set piColumnSpan to 2 Procedure OnClick Send NextPage of oViewer End_Procedure End_Object Object oPreviousPageButton is a cWebButton Set psCaption to "Previous Page" Set piColumnSpan to 2 Set piColumnIndex to 2 Procedure OnClick Send PrevPage of oViewer End_Procedure End_Object End_Object Object oViewerPanel is a cWebPanel Object oViewer is a cWebDRReportViewer Set phoReport to oReport Set pbShowToolbar to False End_Object End_Object End_Object
3.4.12.3.2. PrevPage
Type: Procedure
Default: -
Arguments: -
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 163 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Description: Can be used to instruct the control to navigate to the previous page. If the current
page is the first page nothing happens. The piPage property will be updated on a
successful page change.
Sample: Object oWebMainPanel is a cWebPanel Set pbFillHeight to True Object oToolBar is a cWebPanel Set peRegion to prTop Set piColumnCount to 4 Object oNextPageButton is a cWebButton Set psCaption to "Next Page" Set piColumnSpan to 2 Procedure OnClick Send NextPage of oViewer End_Procedure End_Object Object oPreviousPageButton is a cWebButton Set psCaption to "Previous Page" Set piColumnSpan to 2 Set piColumnIndex to 2 Procedure OnClick Send PrevPage of oViewer End_Procedure End_Object End_Object Object oViewerPanel is a cWebPanel Object oViewer is a cWebDRReportViewer Set phoReport to oReport Set pbShowToolbar to False End_Object End_Object End_Object
3.4.12.3.3. PrintReport
Type: Procedure
Default: -
Arguments: -
Description: Can be used to instruct the control to navigate to print the report.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 164 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Sample: Object oWebMainPanel is a cWebPanel Set pbFillHeight to True Object oToolBar is a cWebPanel Set peRegion to prTop Set piColumnCount to 6 Object oNextPageButton is a cWebButton Set psCaption to "Next Page" Set piColumnSpan to 2 Procedure OnClick Send NextPage of oViewer End_Procedure End_Object Object oPreviousPageButton is a cWebButton Set psCaption to "Previous Page" Set piColumnSpan to 2 Set piColumnIndex to 2 Procedure OnClick Send PrevPage of oViewer End_Procedure End_Object Object oPrintButton is a cWebButton Set psCaption to "Print" Set piColumnSpan to 2 Set piColumnIndex to 4 Procedure OnClick Send PrintReport of oViewer End_Procedure End_Object End_Object Object oViewerPanel is a cWebPanel Object oViewer is a cWebDRReportViewer Set phoReport to oReport Set pbShowToolbar to False End_Object End_Object End_Object
3.4.12.3.4. ShowReport
Type: Procedure
Default: -
Arguments: -
Description: Send this message to the viewer control to start the report data collection, formatting
and viewing. Based on the peMode property a GenerateReportHTML (peMode =
C_HTMLOUTPUT) or a GenerateDownloadLinks (peMode = C_IMAGEOUTPUT) is send to the
report object whose ID is stored in phoReport.
The method sets piPage and piPageCount to 0. These values are calculated at the
client side (JavaScript).
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 165 of 183
z
Business Software for a Changing WorldTM
Type: Procedure
Sample: Object oViewer is a cWebDRReportViewer Set phoReport to oReport End_Object Object oStartButton Is a cWebButton Set psCaption To "Run Report" Procedure OnClick Send ShowReport Of oViewer End_Procedure End_Object
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 166 of 183
z
Business Software for a Changing WorldTM
3.5. Templates The DataFlex Reports library contains one component template which can be used to make a
reportview component in the DataFlex Studio. With this template you can build the same kind of
component as with the wizard when you select "Embedded in Report View". The difference is that you
need to do it all "by hand". The created reportview contains a commandbar object with toolbar, a
cDRReport object and two buttons.
3.5.1. phoReport property
The reportview object defines a property named phoReport in which the object id of the cDRReport
object is stored. This property is used by the commandbar button objects such as oNextPage. Using
this property makes it is easier to change the name of the cDRReport object without further references
that need to be changed.
While you can change the assignment for this property in the code for the cDRReport object this is
neither necessary nor recommended. The code written by the template contains:
Object oReport is a cDRReport Set Size to 215 397 Set Location to 18 7 Set phoReport to Self End_Object
3.5.2. oCommandBars object
A means of browsing through pages of the report preview is desirable. One of the ways to achieve
this is by adding a CodeJock class based toolbar inside the reportview. The toolbar is in fact a
commandbar and thus you see an oCommandBars object.
3.5.3. oDRToolbar object
As standard this object contains 9 button objects to control the previewed report. All the button
objects are instantiated from a class that derives from the cDRMenuItem class. The following toolbar
buttons are created.
3.5.3.1. First Page
This button will, when clicked, send PreviewFirstPage to the report object retrieved by the
ReportObject function call. The picture displayed is FirstPage.bmp and it is advised to add this to the
embedded images via the project properties.
3.5.3.2. Previous Page
This button will, when clicked, send PreviewPreviousPage to the report object retrieved by the
ReportObject function call. The picture displayed is PreviousPage.bmp and it is advised to add this to
the embedded images via the project properties.
3.5.3.3. Current Page
This "button" is an edit control with spin functionality which displays the current page of the report
preview and allows the operator to enter a different page number. The piPreviewCurrentPage will be
set to the entered page number when the operator presses the Enter key or presses the up/down
spin buttons. The report object is retrieved via the ReportObject function call.
3.5.3.4. Next Page
This button will, when clicked, send PreviewNextPage to the report object retrieved by the
ReportObject function call. The picture displayed is NextPage.bmp and it is advised to add this to the
embedded images via the project properties.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 167 of 183
z
Business Software for a Changing WorldTM
3.5.3.5. Last Page
This button will, when clicked, send PreviewLastPage to the report object retrieved by the
ReportObject function call. The picture displayed is LastPage.bmp and it is advised to add this to the
embedded images via the project properties.
3.5.3.6. Refresh Report Data
This button will when clicked send RefreshReport to the report object retrieved by the ReportObject
function call. The picture displayed is Refresh.ico and it is advised to add this to the embedded
images via the project properties.
3.5.3.7. Print Report Data
This button will, when clicked, send PrintReport to the report object retrieved by the ReportObject
function call. The picture displayed is Print.bmp and it is advised to add this to the embedded images
via the project properties.
3.5.3.8. Current Zoom Factor
This "button" is an edit control with a drop down option so that you can enter a zoom factor for the
report freehand or choose from a predefined set of zoom factors. The control will also show the
current zoom factor of the previewed report. The report object to be addressed is retrieved via the
ReportObject function call. The zoom factor must be between 25% and 500%.
3.5.3.9. Export Report Data
This button will, when clicked, send ExportReport to a report options dialog passing the report object
retrieved by the ReportObject function call. The report options dialog is specified in the property
phoExportOptionsDialog defined for the class of this button. The picture displayed is Export.bmp and it
is advised to add this to the embedded images via the project properties.
3.5.4. oReport object
This is the DataFlex Reports proxy object that lets your DataFlex program access the report, alter
filters, sorting, etc and then run the report. The report object by default stores its object id in the
phoReport property of the ReportView object.
3.5.4.1. Events
All events defined for the cDRReport class are supported and can also be
found in the events tab-page of the object properties panel in the DataFlex
Studio.
The template sets up 3 events:
• OnInitializeReport
• OnPageChanged
• OnZoomChanged
The OnPageChanged and OnZoomChanged events communicate with a toolbar
"button" object and it is quite normal to configure the report execution;
therefore OnInitializeReport is added to the object.
3.5.5. Button Objects
Finally the template adds two buttons to the ReportView object. The button named oRunButton sends
RunReport to the report object via the object id in phoReport. The button named oCancelButton
attempts to close the component.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 168 of 183
z
Business Software for a Changing WorldTM
To allow the user to easily execute the messages that the buttons send, two On_Key statements are
added; these send the KeyAction messages to the appropriate button. The key combinations are
Alt+C and Alt+R.
3.5.6. Other Key Mappings
The template also defines On_Key statements for browsing to the first (Ctrl+Home), next
(PageDown), previous (PageUp) & last page (Ctrl+End) of the report.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 169 of 183
z
Business Software for a Changing WorldTM
3.6. Printing It is possible to let the user select a printer via the print dialog or you can specify a printer or you can
print to the default printer. The cDRReport class contains two methods to print the report. This
paragraph explains you how to print a report.
3.6.1. User Selects a Printer
If you want to have the end-user select a printer you can pass a zero as argument to the PrintReport
message and not set the psPrinterName property. The system uses the cPrintDialog object created
with each cDRReport object. The object handle to the cPrintDialog object is stored in phoPrintDialog.
Send PrintReport of oReport 0
3.6.2. Default Printer
If you want to print to the default printer you can send the message PrintToDefaultPrinter to the
report object. This method will retrieve the Windows default printer by using the cPrintDialog object
whose ID is stored in phoPrintDialog. The gathered information will be passed to the PrintReport
method.
Send PrintToDefaultPrinter of oReport
Or:
Set peOutputDestination of oReport to PRINT_TO_PRINTER_NO_DIALOG Send OutputReport of oReport
3.6.3. Printing To a Specific Printer
It is possible to print to a specific printer without the printer selection dialog appearing. For this you
set the psPrinterName property of the report object and send the message PrintReport passing a zero
as message argument.
Set psPrinterName of oReport to "OKI 1234" Set peOutputDestination of oReport to PRINT_TO_PRINTER Set phPrintDlg of oReport to 0 Send OutputReport of oReport
Alternative
Set psPrinterName of oReport to "OKI 1234" Send PrintReport of oReport 0
The name of the printer must be a valid name and its driver properties must be accessible else the
printer selection dialog appears.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 170 of 183
z
Business Software for a Changing WorldTM
3.7. Constants
3.7.1. Main Report ID
The main report ID is stored in the property psReportId. A number of methods and properties require
you to pass a report ID. You can pass the value of the property of the constant C_USEMAINDRREPORTID
(defined as empty string). If the report ID passed equals to C_USEMAINDRREPORTID the class will retrieve
the value of psReportId.
3.7.2. Database Types
Each report – and each sub-report – can have one type database (data source). The following values
can be returned by the function DatabaseType.
Constant Value
C_drDF 1
C_drODBC 2
C_drRDS 4
C_drSP 5
C_drSQL 6
3.7.3. Export formats
The report can be exported to five different export formats. One of the constants below needs to be
passed as argument with the ExportReport message.
Constant Value
C_drPDF 0
C_drCSV 1
C_drImage 2
C_drHTML 3
C_drXLS 4
C_drRTF 5
3.7.4. HitTest
A Windows report integration can be made responsive by implementing the OnReportPreviewClick
event. The first argument of this event equals to one of the following constants.
Constant Value
C_drNowhere 1
C_drSection 2
C_drObject 3
3.7.5. Image formats
Reports can be exported as image file(s) with the ExportReport method. The format of the image
needs to be specified in a member of a drImageExportOptions variable as one of the following
constants.
Constant Value
C_drJPEG 1
C_drGIF 2
C_drTIFF 3
C_drPNG 4
3.7.6. PDF page modes
PDF export files can use one of the following constants as the page mode. Page mode is a member of
a variable of the PDFExportOptions structure.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 171 of 183
z
Business Software for a Changing WorldTM
Constant Value
C_drNormal 0
C_drOutline 1
C_drThumbs 2
C_drFullScreen 3
3.7.7. PDF image qualities
PDF export files may contain pictures. High quality images usually create a larger PDF file. The
following constants can be used for a member of the PDFExportOptions structure variable set via
pPDFExportOptions.
Constant Value
C_drLow 0
C_drHigh 1
3.7.8. PDF types
PDF export supports standard/normal PDF files as well as PDF/A files. PDF/A is meant for digital
preservation of electronic documents. The following constants can be used for a member of the
PDFExportOptions structure variable set via pPDFExportOptions.
Constant Value
C_drPDFNormal 0
C_drPDFA 1
3.7.9. Report statistics
Several actions are timed and the values are passed to the report integration via the
OnReportStatistics event. The first argument of this event is one of the following values.
Constant Value
C_drReportOpen 1
C_drExecutionPlan 2
C_drExecution 3
C_drReadRecords 4
C_drSortRecords 5
C_drCountPages 6
C_drFormatPages 7
3.7.10. Language
The following language constants are defined. They are not all supported at this time.
Constant Supported
LANG_NEUTRAL / LANG_DEFAULT Built In, Yes
LANG_AFRIKAANS -
LANG_ALBANIAN -
LANG_ARABIC -
LANG_ARMENIAN -
LANG_ASSAMESE -
LANG_AZERI -
LANG_BASQUE -
LANG_BELARUSIAN -
LANG_BENGALI -
LANG_BULGARIAN -
LANG_CATALAN -
LANG_CHINESE -
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 172 of 183
z
Business Software for a Changing WorldTM
Constant Supported
LANG_CROATIAN -
LANG_CZECH Yes
LANG_DANISH -
LANG_DIVEHI -
LANG_DUTCH Yes
LANG_ENGLISH Yes
LANG_ESTONIAN -
LANG_FAEROESE -
LANG_FARSI -
LANG_FINNISH -
LANG_FRENCH Yes
LANG_GALICIAN -
LANG_GEORGIAN -
LANG_GERMAN Yes
LANG_GREEK -
LANG_GUJARATI -
LANG_HEBREW -
LANG_HINDI -
LANG_HUNGARIAN Yes
LANG_ICELANDIC -
LANG_INDONESIAN -
LANG_ITALIAN Yes
LANG_JAPANESE -
LANG_KANNADA -
LANG_KASHMIRI -
LANG_KAZAK -
LANG_KONKANI -
LANG_KOREAN -
LANG_KYRGYZ -
LANG_LATVIAN -
LANG_LITHUANIAN -
LANG_MACEDONIAN -
LANG_MALAY -
LANG_MALAYALAM -
LANG_MANIPURI -
LANG_MARATHI -
LANG_MONGOLIAN -
LANG_NEPALI -
LANG_NORWEGIAN -
LANG_ORIYA -
LANG_POLISH Yes
LANG_PORTUGUESE Yes
LANG_PUNJABI -
LANG_ROMANIAN -
LANG_RUSSIAN -
LANG_SANSKRIT -
LANG_SERBIAN -
LANG_SINDHI -
LANG_SLOVAK -
LANG_SLOVENIAN -
LANG_SPANISH Yes
LANG_SWAHILI -
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 173 of 183
z
Business Software for a Changing WorldTM
Constant Supported
LANG_SWEDISH Yes
LANG_SYRIAC -
LANG_TAMIL -
LANG_TATAR -
LANG_TELUGU -
LANG_THAI -
LANG_TURKISH -
LANG_UKRAINIAN -
LANG_URDU -
LANG_UZBEK -
LANG_VIETNAMESE -
3.7.11. Sort order
One of the following constants can be passed as the eSortOrder parameter for the AddRecordSortField
message.
Constant Value
C_drAscending 1
C_drDescending 2
3.7.12. Filter operators
One of the following constants can be passed as the eFilterOperator parameter for the AddFilter
message. It is also used for the peFilterOperator property.
Constant Value
C_drNone 0
C_drEqual 1
C_drNotEqual 2
C_drGreaterThan 3
C_drGreaterThanOrEqual 4
C_drLessThan 5
C_drLessThanOrEqual 6
3.7.13. OCX version and name
The OCXVersion function returns the version number of the Developer Edition OCX file currently
loaded. The first two digit groups of the value returned can be compared against the
C_DR_OCX_VERSION constant. The Name constant is used to find the correct module in memory.
Constant Value
C_DR_OCX_VERSION 5.0
C_DR_OCX_NAME DataFlex Reports 2016 Developer Edition API.ocx
3.7.14. Excel versions
Microsoft Excel export may use of the following version constants. The typical file extension for a 2003
Excel file format is XLS and the 2007 file format is XLSX. The constant can be used to set the
iXLSVersion memberof a drXLSExportOptions structure variable.
Constant Value
C_drXLS2003 0
C_drXLS2007 1
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 174 of 183
z
Business Software for a Changing WorldTM
3.7.15. Excel new sheet options
Microsoft Excel export files may contain the full report as one sheet or a sheet per page. The following
constants can be used to set the iNewSheet member of the drXLSExportOptions structure variable.
Constant Value
C_drNoSheets 0
C_drSheetsPage 1
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 175 of 183
z
Business Software for a Changing WorldTM
3.8. Structs
3.8.1. CSV export options
The name of this struct is drCSVExportOptions. It is used by the DefaultCSVExportOptions method and
pCSVExportOptions.
Member Type Description Default Value cFieldDelimiter String Character that is used as field delimiter Comma (,) cFieldSeparator String Character that is used as field separator Double quote (") bExportPageSections Integer Export of page sections False bExportReportSections Integer Export of report sections False bExportGroupSections Integer Export of group sections False bAllPages Boolean Export all pages or single page True iPage Integer Page number of single page to export 1
3.8.2. HTML export options
The name of this structure is drHTMLExportOptions. It is used by the DefaultCSVExportOptions method
and pHTMLExportOptions property.
Member Type Description Default Value bMultiPage Boolean Export all pages (one file per page) or
single page
True
iPage Integer Page number of single page to export 0
3.8.3. Image export options
The name of this structure is drImageExportOptions. It is used by the DefaultImageExportOptions
method and pImageExportOptions property.
Member Type Description Default Value iImageType Integer Can be one of:
• C_drJPEG
• C_drGIF
• C_drTIFF
• C_drPNG
C_drTIFF
bMultiPage Boolean Export all pages (image type TIFF only) or
single page
True
iPage Integer Page number of single page to export 0
3.8.4. PDF export options
The name of this struct is drPDFExportOptions. It is used by the DefaultPDFExportOptions method and
pPDFExportOptions property.
Member Type Description Default Value iPageMode Integer One of:
• C_drNormal
• C_drOutline
• C_drThumbs
• C_drFullScreen
C_drNormal
iPDFType Integer One of:
• C_drPDFNormal
• C_drPDFA
C_drPDFNormal
sOwnerPassword String Password for altering the PDF. ''
sUserPassword String Password for opening the PDF. ''
iImageQuality One of: • C_drLow
C_drLow
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 176 of 183
z
Business Software for a Changing WorldTM
Member Type Description Default Value
• C_drHigh bAllPages Boolean Export all pages or single page True iPage Integer Page number of single page to export 0
3.8.5. RTF export options
The name of this structure is drRTFExportOptions. It is used by the DefaultRTFExportOptions method
and pRTFExportOptions property.
Member Type Description Default Value bAllPages Boolean Export all pages or a single page True iPage Integer Page number of single page to export 1
3.8.6. Excel export options
The name of this structure is drXLSExportOptions. It is used by the DefaultXLSExportOptions method
and pXLSExportOptions property.
Member Type Description Default Value iXLSVersion Integer One of:
• C_drXLS2003 (XLS)
• C_drXLS2007 (XLSX)
C_DRXLS2007
iNewSheet Integer One of:
• C_drNoSheets (all pages on one sheet)
• C_drSheetsPage (one sheet per page)
C_DRNoSheets
iColumnWidth Integer Width of a cell in the spreadsheet. Value
between 5 and 999.
30
bExportDataOnly Boolean True if only the data should be exported.
False if the report should be formatted.
False
bExportPageSections Boolean True if the page sections (Page header
and footer) should be exported.
True
bExportReportSections Boolean True if the report sections (Report header
and footer) should be exported.
True
bExportGroupSections Boolean True if the group sections (Group 1-N
headers and footers) should be exported.
True
bAllPages Boolean Export all pages or single page True iPage Integer Page number of single page to export 1
3.8.7. Functions defined in a report
The name of this struct is tReportFunctionId. It is used by the ReportIdForFunction and
ReportIdsForFunction method.
Member Type Description sReportId String The report ID. iFunction Integer A function number.
3.8.8. Report tables in a runtime data source
The name of this struct is tDRTableName. It is used by the RDSTableNames method.
Member Type Description sReportId String The unique ID of the report. iTable Integer The table number. sTableName String The name of the table.
3.8.9. Parameter information
The name of this struct is tDRParameter. It is used by the ParameterInfo and Parameters methods.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 177 of 183
z
Business Software for a Changing WorldTM
Member Type Description sName String The parameter name. iType Integer The datatype of the parameter. iLength Integer The length of the parameter datatype. iPrecision Integer The precision of the parameter datatype.
3.8.10. Parameters defined in a report
The name of this struct is tReportParameterId. It is used by the ReportIdsForParameter method.
Member Type Description sReportId String The report ID. iParameter Integer A parameter number.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 178 of 183
z
Business Software for a Changing WorldTM
4. Deploying the DataFlex Reports Developer
Edition Runtime The DataFlex Reports Runtime can be distributed royalty-free with your reports and DataFlex
Windows application only if you have a legitimately licensed DataFlex Reports Developer Edition. For
Web applications a Web Deployment license (per server) is required.
The target platform for deployment requires as minimum a DataFlex Client Engine based system, but
a development version of DataFlex is certainly allowed.
The Software License Agreement explains these distribution entitlements in detail. If you have any
questions about licensing, send an email to [email protected].
The DataFlex Reports Developer Edition Workstation Runtime consists of the following components
required to execute Reports:
Module Description Version
DataFlex Reports 2016
Developer Edition
API.ocx
The DataFlex Reports API 5.0
Df_collate.cfg The collating sequence used for DataFlex embedded data
sources.
-
Language.db A SQLite database with translation text strings. If the file is
missing, the built-in default language is used. The file needs
to be in the same folder as the DataFlex Reports OCX.
-
DR.db A SQLite database in which the repositories, label definitions
and imported ELF functions are stored. The file needs to be
placed at a location to which you have write access. The file
is located in the following ways:
• Sub folder of ProgramData; in Windows Vista or later the
exact folder is C:\ProgramData\Data Access Worldwide\DataFlex Reports\5.0\Data
• Directory of the DataFlex Reports OCX
-
The Runtime can best be deployed in the same directory as your DataFlex application, which can be
either on the licensed personal computer or on a network server. Typically, this is the \Programs
directory of the deployed workspace.
Register the DataFlex Reports 2016 Developer Edition API.ocx on the deployment computer(s). Use
the Windows RegSvr32 tool for this. On Windows Vista and later you should run RegSvr32 with "run
as administrator".
Note: The internal structure of the dr.db file changed in version 5. Using a dr.db of an older version
causes label reports to fail.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 179 of 183
z
Business Software for a Changing WorldTM
5. Product support Free support for DataFlex Reports is limited to the validity of your product subscription plan. Read
more about how Data Access handles support at http://www.dataaccess.eu/support.
The support of DataFlex Reports can be reached via the following ways:
• Local distributor.
• The Data Access Worldwide forums (http://support.dataaccess.com/forums).
• An e-mail to Data Access Europe directly ([email protected]).
• Direct entering your support request in the online support database (http://hde.dataaccess.eu).
Send an e-mail to [email protected] to get an account to HDE.
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 180 of 183
z
Business Software for a Changing WorldTM
6. Index
Activating (event) ..................................... 139
AddComboValues (event) .......................... 142
AddFilter (method) ............................. 74, 173
Adding library to workspace .......................... 8
AddRecordSortField (method) ............. 75, 173
Base64 .................................................... 136
btCurrentWindow (constant) ..................... 132
btNewTab (constant) ................................ 132
btNewWindow (constant) .......................... 132
C_DR_OCX_NAME (constant) .................... 173
C_DR_OCX_VERSION (constant) ......... 95, 173
C_drAscending (constant) ..... 59, 75, 142, 173
C_drCountPages (constant) ................. 73, 171
C_drCSV (constant) ........... 40, 68, 70, 87, 170
C_drDescending (constant) ... 59, 75, 142, 173
C_drDF (constant) .............................. 77, 170
C_drEqual (constant) .................... 43, 75, 173
C_drExecution (constant) .................... 73, 171
C_drExecutionPlan (constant) ............. 73, 171
C_drFormatPages (constant) ............... 73, 171
C_drFullScreen (constant) ................. 171, 175
C_drGIF (constant) ................... 132, 170, 175
C_drGreaterThan (constant) ......... 43, 75, 173
C_drGreaterThanOrEqual (constant) ..... 43, 75,
173
C_drHigh (constant) ......................... 171, 175
C_drHTML (constant) ........ 40, 68, 70, 87, 170
C_drImage (constant) ....... 40, 68, 70, 87, 170
C_drJPEG (constant) ................. 132, 170, 175
C_drLessThan (constant) .............. 43, 75, 173
C_drLessThanOrEqual (constant) .. 43, 75, 173
C_drLow (constant) .......................... 171, 175
C_drNone (constant) .......................... 43, 173
C_drNormal (constant) ..................... 171, 175
C_drNoSheets (constant) .................. 174, 176
C_drNotEqual (constant) ............... 43, 75, 173
C_drNowhere (constant) ..................... 73, 170
C_drObject (constant) ........................ 73, 170
C_drODBC (constant) .......... 77, 120, 122, 170
C_drOutline (constant) ..................... 171, 175
C_drPDF (constant) ........... 40, 68, 70, 87, 170
C_drPDFA (constant) ................................ 171
C_drPDFNormal (constant)........................ 171
C_drPNG (constant) .................. 132, 170, 175
C_DRPREVIEW_EMBEDDED (constant) ....... 57
C_DRPREVIEW_MODAL (constant) ........ 56, 57
C_DRPREVIEW_TOOLPANEL (constant) 56, 57,
125, 145, 149
C_DRPREVIEW_VIEW (constant) .... 55, 56, 57,
125, 145
C_drRDS (constant) .......................... 123, 170
C_drReadRecords (constant) .............. 73, 171
C_drReportOpen (constant) ................ 73, 171
C_drRTF (constant) ........... 40, 68, 70, 87, 170
C_drSection (constant) ....................... 73, 170
C_drSheetsPage (constant) .............. 174, 176
C_drSortRecords (constant) ................ 73, 171
C_drSP (constant) ............... 77, 120, 124, 170
C_drSQL (constant)................................... 170
C_drThumbs (constant) .................... 171, 175
C_drTIFF (constant) ......................... 170, 175
C_drXLS (constant) ........... 40, 68, 70, 87, 170
C_drXLS2003 (constant) ................... 173, 176
C_drXLS2007 (constant) ................... 173, 176
C_USEMAINDRREPORTID (constant)... 33, 170
CancelReport (method) ...............................76
cCJGridColumn (class) ....................... 137, 141
CDbl (function) ...................................86
cDRCurrentPageMenuItem (class) .............. 143
cDRExportMenuItem (class) ...................... 143
cDRFirstPageMenuItem (class) .................. 143
cDRLastPageMenuItem (class) ................... 143
cDRMenuItem (class) ....................... 143, 149
cDRNextPageMenuItem (class) .................. 143
cDRPreview (class) .............. 55, 125, 143, 145
cDRPreviewWindow (class) .. 56, 146, 148, 149
cDRPreviousPageMenuItem (class) ............ 143
cDRPrintMenuItem (class) ......................... 143
cDRRefreshMenuItem (class) ..................... 143
cDRReport (class) ............................. 167, 169
cDRSortColumnsGrid (class) ............. 137, 141
cDRSortDirectionsGridColumn (class) 137, 141
cDRToolPanelPreview (class) 125, 143,
149
cDRWebSortColumnsGrid (class) ....... 152, 155
cDRWebSortDirectionColumn (class) . 152, 155
cDRZoomMenuItem (class) ........................ 143
CInt (function) ...................................85
CloseReport (method) .......................... 32, 77
Comma Separated Values ................... See CSV
cPrintDialog (class) .................. 30, 54, 55, 169
CStr (function) ...................................87
CSV ................................................ 32, 35, 40
Export options .......................... 35, 79, 175
cWebDRReportViewer (class) ...... 132, 136, 157
cWebIFrame (class) .................................. 133
Database Types ........................................ 170
DatabaseType (method) ................ 31, 77, 170
DateSerial (function) ...................................84
DateTimeToString (method) ................. 78, 85
DateToString (method) ........................ 79, 85
DefaultCSVExportOptions (method) 35, 79, 175
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 181 of 183
z
Business Software for a Changing WorldTM
DefaultHTMLExportOptions (method) .... 47, 80
DefaultImageExportOptions (method) .. 48, 80,
175
DefaultPDFExportOptions (method) ...... 51, 81,
133, 136, 175
DefaultRTFExportOptions (method) 62, 82, 176
DefaultXLSExportOptions (method) 66, 82, 176
Deploying the runtime .............................. 178
DF_OPEN_PATH ......................................... 36
DisplayReport (method) ............ 31, 67, 69, 83
DisplayStatusPanel (method) ...................... 84
drCSVExportOptions (struct) ......... 35, 79, 175
DRDate (method) ....................................... 84
drHTMLExportOptions (struct) ....... 47, 80, 175
drImageExportOptions (struct) ...... 47, 80, 135,
170, 175
DRInteger (method) ................................... 85
DRNumber (method) .................................. 86
drPDFExportOptions (struct) . 51, 81, 133, 175
drRTFExportOptions (struct) ......... 62, 82, 176
DRStatusPanel ........................................... 64
DRString (method) ..................................... 87
drXLSExportOptions (struct) . 66, 82, 173, 174,
176
Error_Report ........................................ 32, 67
Excel ................................................... 32, 40
Export options .......................... 66, 82, 176
New sheet options ................................ 174
Versions ............................................... 173
Export formats ......................................... 170
Export options
CSV .......................................... 35, 79, 175
Excel ........................................ 66, 82, 176
HTML ....................................... 47, 80, 175
Image ...................................... 47, 80, 175
PDF .......................................... 51, 81, 175
RTF .......................................... 62, 82, 176
ExportFileNamesSet (method) ................... 134
ExportReport ............................................ 136
ExportReport (method) ...... 31, 68, 70, 87, 170
ExportReport (method) )
cDRReport (class) ................................. 167
ExportReportToDownload ......................... 134
ExportReportToDownloadURL (method) ..... 134
Filter operators................................... 43, 173
FilterCount (method) .................................. 88
FiltersDefined (method ............................... 89
FunctionCount (method) ....................... 31, 90
FunctionIdByName (method) ................ 31, 90
FunctionLength (method) ........................... 91
FunctionType (method) .............................. 92
GenerateDownloadLinks (method) ...... 133, 135
GenerateReport (method) ....... 133, 135, 136
GenerateReportHTML (method) ................ 136
GIF ............................. See C_drGIF (constant)
HitTest ..................................................... 170
HTML ................................................... 32, 40
Export options .......................... 47, 80, 175
HTMLPreviewData (method) ................ 93, 136
Image
Export options .......................... 47, 80, 175
Formats ................................................ 170
Integration Wizard ....................................... 9
intermediate files ........................................30
IsEnabled (event) ..................................... 144
IsFileList (method) ......................................94
JPEG ........................ See C_drJPEG (constant)
Language ................................. 16, 25, 32, 33
Constants .............................................. 171
LoadData (method) ................................... 140
Maximize_Icon ............................................33
NavigateToPage (method) .......... 132, 133, 136
NextPage (method) ................................... 162
oCommandBars (object) ............................ 166
OCX ....................................................... 7, 27
OCX name ................................................ 173
OCX version....................................... 95, 173
OCXVersion (method) .................................95
oDRStatusPanel (object)..............................64
oDRToolbar (object) .................................. 166
OnClickActionLink (event) ................. 158, 161
OnClosePreviewer (event) ...........................66
OnDefineFilters (event) ...............................67
OnDisplayReport (event) .................34, 67, 83
OnError (event) ..............................32, 46, 67
OnExportReport (event) ..................34, 68, 87
OnFill (event) ........................................... 156
OnInitializeReport (event) ...............34, 68, 96
OnOpenReport (event) ..................... 159, 161
OnPageChange (event) ............................. 161
OnPageChanged (event)
cDRPreview (class) ................................ 146
cDRReport (class) ....................................69
cDRToolPanelPreview (class) .................. 150
OnPostDisplayReport (event) ................ 69, 83
OnPostExportReport (event) ................. 70, 88
OnPostPrintReport (event) .................. 70, 109
OnPreOpenReport (event) ...........................71
OnPrintReport (event) ................... 34, 71, 109
OnProgressFormatPage (event) ............ 31, 71
OnProgressRecordsRead (event) ............ 31, 72
OnReportInfo (event) ........................... 63, 72
OnReportPreviewClick (event) ............ 73, 170
OnReportStatistics (event) .................. 73, 171
OnSetPDFExportOptions (event) ........ 133, 136
OnSetSortColumns (event) ........................ 154
OnShowPreviewer (event) ...........................74
OnZoomChanged (event)
cDRPreview (class) ................................ 146
cDRReport (class) ....................................74
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 182 of 183
z
Business Software for a Changing WorldTM
cDRToolPnalePreview (class) ................. 150
OpenReport (method) .... 30, 68, 95, 125, 135,
136
Operators ......................... See Filter operators
oReport (object) ....................................... 167
OutputReport (method) ...................... 96, 125
PaperOrientation (method) ......................... 97
PaperSize (method) .................................... 98
ParameterCount (method) .................... 33, 99
ParameterIdByName (method) .................. 100
ParameterInfo (method) ................... 101, 176
ParameterName (method) .................. 33, 102
Parameters .......................................... 12, 20
Parameters (method) ....................... 103, 176
ParameterType (method) .................... 33, 104
pbAllowMaximizeView (property) ................. 33
pbAutoLocateDFFiles (property) 30, 32, 34, 94
pbCanceled (property) .................... 32, 34, 76
pbCancelIfError (property) .... 32, 35, 106, 107,
108
pbDisplayError (property) ............... 32, 38, 67
pbHasErrors (property) 46, 106, 107, 108, 125
pbServerOnClickActionLink (property) 158, 161
pbServerOnOpenReport (property) .... 159, 161
pbServerOnPageChange (property) ... 159, 161
pbShowInformationMessages (property) 63, 72
pbShowPrintButton (property) ................... 159
pbShowStatusPanel (property) .. 31, 63, 64, 84
pbShowToolbar (property) ........................ 160
pCSVExportOptions (property) . 32, 35, 40, 88,
175
PDF ..................................................... 32, 40
export options ..................................... 175
Export options .................................. 51, 81
PDF image qualities .................................. 171
PDF page modes ...................................... 170
PDFExportOptions (struct) ................. 170, 171
peBrowserTarget (property) ...................... 136
peBrowserTarget (property) ...................... 132
peExportType (property) ............................. 40
peFilterOperator (property) ...... 41, 43, 44, 173
peImageType (property) ........................... 135
peImageType (property) ........................... 132
peMode (property) ................................... 157
peOutputDestination (property) ............. 31, 48
pePreviewStyle (property) ................... 57, 125
peRecordSortOrder (property) ..................... 59
peToolbarAlignment (property) ................. 160
phcPreviewer (property) 55, 56, 125, 145, 149
phoExportOptionsDialog (property) ............ 40
phoPreviewContainer (property) ...... 56, 69, 74
phoPrintDialog (property) ............. 54, 58, 169
phoReport (property) ................................ 158
cDRMenuItem (class) ............................ 143
cDRPreview (class) ................................ 146
cDRToolPanelPreview (class) .................. 149
Template .............................................. 166
phoReportViewer (property) ...................... 135
phoReportViewer (property) ...................... 133
phoSortDirectionColumn (property) ............ 153
phoStatusPanel (property) .................... 31, 63
phPrintDlg (property) ..................................54
pHTMLExportOptions (property) 32, 40, 47, 88,
175
pImageExportOptions (property) .... 32, 40, 47,
88, 175
piPage (property) ...................................... 157
piPageCount (property) ............................. 158
piPaperMarginBottom (property) ..................49
piPaperMarginLeft (property) .......................49
piPaperMarginRight (property) .....................50
piPaperMarginTop (property) .......................50
piPreviewCurrentPage (property) .................52
cDRReport (class) ....................................32
piPreviewZoom (property) ...........................53
piReportLanguage (property) .......................60
piZoom (property) .................................... 160
PNG .......................... See C_drPNG (constant)
Popup_Modal ..............................................57
Popup_State ...............................................64
Portable Document Format ................. See PDF
pPDFExportOptions (property) .. 32, 40, 51, 88,
171, 175
PreviewFind (method)
cDRReport (class) ................................. 105
PreviewFirstPage (method)
cDRPreview (class) ................................ 147
cDRReport (class) ............................ 32, 106
cDRToolPanelPreview (class) .................. 150
PreviewLastPage (method)
cDRPreview (class) ................................ 147
cDRReport (class) .................... 32, 107, 167
cDRToolPanelPreview (class) .................. 151
PreviewNextPage (method)
cDRPreview (class) ................................ 148
cDRReport (class) .................... 32, 107, 166
cDRToolPanelPreview (class) .................. 151
PreviewPreviousPage (method)
cDRPreview (class) ................................ 148
cDRReport (class) ........................... 32, 108
cDRToolPanelPreview (class) .................. 151
PrevPage (method) ................................... 162
Printing .................................................... 169
PrintReport (method)
cDRReport (class) .................... 31, 108, 169
cWebDRReportViewer (class) ................. 163
PrintReport (Procedure) ............................ 169
PrintToDefaultPrinter (method) ......... 109, 169
pRTFExportOptions (property) ............ 62, 176
psAscendingText (property) .............. 141, 155
+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AE Hengelo, The Nether lands
Page 183 of 183
z
Business Software for a Changing WorldTM
psCaption (property) ................................ 143
psClientOnClickActionLink (property) ......... 161
psDatabaseConnection (property) ......... 31, 36
psDatabaseName (property) ................. 31, 37
psDescendingText (property) ............ 142, 156
psExportFileName (property)....................... 39
psFilterField (property) ................... 41, 43, 44
psFilterFunction (property) .......................... 42
psFilterFunction (property) .......................... 31
psFilterValue (property) .................. 41, 43, 44
psFunction (property) ........................... 31, 45
psFunctionName (property) .................. 31, 46
psParameterValue (property) ................ 33, 50
psPreviewCaptionLabel (property) ............... 55
psPrinterName (property) ................... 58, 169
psRecordSortField (property) ...................... 58
psReportId (property) ......................... 60, 170
psReportLocation (property) ....................... 61
psReportName (property) ............. 30, 61, 135
psReportPath (property) ............................. 62
psTableName (property) ....................... 31, 64
psTableSchema (property) .................... 31, 65
psURL (property) ...................................... 133
pXLSExportOptions (property) .. 32, 40, 66, 88,
176
RDS .................................................. 110, 123
RDSTableNames (method) ................ 110, 176
RecordSortCount (method) ....................... 112
RefreshReport (method) ..................... 67, 113
RefreshReport (method) ........................... 167
RemoveAllFilters (method) ........................ 113
RemoveAllRecordSortFields (method) ........ 114
RemoveFilter (method) ............................. 115
RemoveRecordSortField (method) ............. 116
Report ID ................................................. 170
Report statistics ....................................... 171
ReportCacheFileName (method) ......... 116, 136
ReportIdForFunction (method) .......... 117, 176
ReportIdsForFunction (method) ........ 118, 176
ReportIdsForParameter (method) ...... 118, 177
ReportObject (method) ...................... 144, 167
phoExportOptionsDialog (property) ............ 145
ReportPageCount ...................................... 134
ReportPageCount (method) ....................... 119
ReportQuery (method) .............................. 120
ReportsCacheFolder .................................. 134
ReportsCacheFolder (method) ................... 121
ReportsFolder (method) ...................... 62, 121
ReportUsesODBC (method) ....................... 122
ReportUsesRDS (method) .......................... 123
ReportUsesStoredProcedures (method) 99, 124
RTF ............................................................40
Export options .......................... 62, 82, 176
RunReport (method) ................................. 125
SetDefaultPreviewerClass (method) .. 125, 149
ShowReport (method) ....................... 136, 164
Sort order ................................................. 173
SortColumnSet (method) ........................... 155
SortDirection (method) .............................. 142
SQL.......................................................... 120
SubReportCount (method) .................. 32, 126
SubReportId (method) .............................. 127
SubReportID (method) ................................32
SubReportIDByName (method) .................. 127
Support .................................................... 179
SwitchRows (method) ............................... 140
TableCount (method) ......................... 31, 128
TableData (method) .................................. 129
tDRParameter (struct) ............... 101, 103, 176
tDRTableName (struct) ............................. 176
Templates ................................................ 166
TestFilterFunction (method) ............... 31, 130
TIFF .......................... See C_drTIFF (constant)
TimeToString (method) ............................. 131
tNameValuePair (struct) ............................ 134
TotalParameterCount (method) ................. 131
Translation .................................................33
tReportFunctionId (struct) ......................... 176
tReportParameterId (struct) ...................... 177
XLS ................................................. See Excel
XLSX ............................................... See Excel