+ All Categories
Home > Documents > DataFlex Reports Developer Guide - Data Access Europe...

DataFlex Reports Developer Guide - Data Access Europe...

Date post: 16-Apr-2018
Category:
Upload: dangkhanh
View: 231 times
Download: 1 times
Share this document with a friend
247
DataFlex Reports Developer Guide Integrate DataFlex Reports in your DataFlex Applications
Transcript
Page 1: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

DataFlex Reports

Developer Guide Integrate DataFlex Reports in your DataFlex Applications

Page 2: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 2 of 247 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: December, 2014

DataFlex Reports Developer

Guide

Page 3: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 3 of 247 z

Business Software for a Changing WorldTM

COPYRIGHT NOTICE

© 2009-2014 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.

DB2 is a registered trademark of IBM Corporation.

Pervasive.SQL is a registered trademark of Pervasive Software, Inc.

Windows Server 2008, Windows Server 2003, Windows 7, Windows Vista, Windows XP, Windows ME, Windows

2000 and Windows 98 are registered trademarks of Microsoft Corporation.

All other company, brand, and product names are registered trademarks or trademarks of their respective

holders.

Page 4: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 4 of 247 z

Business Software for a Changing WorldTM

Table of Contents

1. Welcome to DataFlex Reports! ........................................................................... 5

2. Application Integration ....................................................................................... 6

2.1 Adding the DataFlex Reports Library to a Workspace ............................................................. 6

2.2 Getting started with the Integration Wizard ........................................................................... 7

2.3 DataFlex Reports Application Programming Interface .......................................................... 21

2.4 cDRReport class ....................................................................................................................... 23

2.5 cDRSortColumnsGrid class .................................................................................................... 167

2.6 cDRSortDirectionsGridColumn class .................................................................................... 173

2.7 cDRMenuItem class ............................................................................................................... 179

2.8 cDRExportMenuItem class .................................................................................................... 183

2.9 cDRPreview class ................................................................................................................... 184

2.10 cDRPreviewWindow class ................................................................................................... 192

2.11 cDRToolPanelPreview class ................................................................................................ 193

2.12 cDRWebSortColumnsGrid class .......................................................................................... 201

2.13 cDRWebSortDirectionColumn class ................................................................................... 206

2.14 cWebDRReportViewer class ............................................................................................... 211

2.15 Templates ............................................................................................................................ 231

2.16 Printing ................................................................................................................................. 234

2.17 Constants ............................................................................................................................. 235

2.18 Structs .................................................................................................................................. 239

3. Deploying the DataFlex Reports Developer Edition Runtime .......................... 242

4. Product support ............................................................................................. 243

Index .................................................................................................................. 244

Page 5: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 5 of 247 z

Business Software for a Changing WorldTM

1. 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 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.

Page 6: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 6 of 247 z

Business Software for a Changing WorldTM

2. 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.

2.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. Browse to the library

folder that matches with the DataFlex

product currently used. 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.

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 only needed if the DataFlex Reports library was

moved from the folder selected during the installation process of DataFlex Reports.

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 contents need to be copied and the CSS file for DataFlex Reports need to

be loaded. One of the ways to do this is via including in the application.css file. The wizard will disable the

option of including if no application.css file can be found. If a web application is being developed the

JavaScript class for previewing DataFlex Reports documents need to be loaded. The wizard looks for a file named

index.html (default for DataFlex web applications) and offer to update this file. Deselect update

application.css and/or index.html if a manual action is desired.

Page 7: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 7 of 247 z

Business Software for a Changing WorldTM

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 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).

2.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.

2.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.

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. 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

Page 8: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 8 of 247 z

Business Software for a Changing WorldTM

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.

In the next wizard page –

titled ‘Names’ – the

component object name, the

file name and description to

be used for the menu item

creation can be entered. 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. In the picture

the name

‘oCustomerListReportView’ is

shown as the object name

because the name of the

selected report was

CustomerList.dr. The object

name needs be unique within

the current project. The wizard will generate a ReportView based object that will be used to address the module.

Press the Next button again for the next wizard page in which columns can be selected that allow the end-user

to specify selection criteria.

The columns ‘Customer_Number’ and ‘Customer_City’ are shown as selected columns. If the end-user enters

values in the input controls the data will be filtered on these values. Two input controls will be created for all

selected columns to make a range selection possible. All code generated by the wizard can be modified.

The order of the input controls can be changed via right mouse click as shown in

the 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 coding.

Page 9: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 9 of 247 z

Business Software for a Changing WorldTM

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.

The next wizard page again

depends on the report

definition. If the report

contains parameters, the

CustomerList.dr does not contain parameters, a page will be shown in which parameters can be selected for

which an input control will be created. 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.

An input control will be

generated for each of the

selection and or parameter

fields.

The generated label for the

input control can be changed

in the labels and alignment

wizard page.

On the same wizard page the

label justification mode can be

chosen by clicking the

corresponding radio in the

‘Justification’ group.

Finally it is possible to set the

peAnchors property of the

input controls by selecting

‘left-right’ or ‘none’ from the

combo-form control. The

width of the input controls will change if ‘left-right’ is chosen and the report view component gets more or less

wide.

Page 10: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 10 of 247 z

Business Software for a Changing WorldTM

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.

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:

• Modal dialog

• MDI view

• Embedded

• Toolpanel

Modal preview of the results

need to be closed before

further interaction with the

application can be done.

An MDI view preview style

interface dynamically creates a view object (MDI child window) in the application’s client area, displaying the

report results.

Choose for ‘Embedded in report view’ if results and selection criteria needs to be placed on the same view. The

wizard generates a report view with two tab-pages, one for the selection criteria and one for the results.

Page 11: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 11 of 247 z

Business Software for a Changing WorldTM

The fourth option, toolpanel, 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.

The next step in the process

concerns the enclosure of

bitmaps and icons.

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 they can be embedded

in the compiled project. The

DataFlex compiler embeds the

images listed in the

<project-name>.cfg file in

the compiled executable.

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.

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.

Sorting inside DataFlex

Reports uses a collating

sequence which is maintained

in a file. By default the

DataFlex development

collating sequence file

(df_collate.cfg in the bin

folder) is copied to the

DataFlex Reports design

environment during

installation. The integration

Page 12: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 12 of 247 z

Business Software for a Changing WorldTM

might need to use a different collating sequence to that of the application and this can be done by specifying the

path to and the name of the file with the (different) collating sequence information.

If the report is based on an ODBC data-source the third option can be selected which generates code in the

report object in which a change in the data-source can be programmed.

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.

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.

The generated Report View is now available in DataFlex Studio.

Notice the prompt buttons and the drop-down controls for the selection

of ‘Customer Number’ and ‘State’. These are available because the data

dictionary class for the customer table in this workspace defines a

selection list and a code validation table.

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.

The DataFlex Reports print engine object is visible as a small square in the

top left corner of the report view. This should not be made smaller as a

size of 2x2 is needed to get the preview working correctly.

Page 13: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 13 of 247 z

Business Software for a Changing WorldTM

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.

2.2.2 Report integration for 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:

For the explanation of the wizard that follows it is assumed that:

• The ‘WebOrder’ 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.

Page 14: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 14 of 247 z

Business Software for a Changing WorldTM

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. 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.

Page 15: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 15 of 247 z

Business Software for a Changing WorldTM

In the next wizard page the

name of the report view

object, 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 object needs

to be unique in the web

project.

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.

In the next wizard page fields

can be selected for which the

wizard creates input controls

allowing the end-user to make

selections.

For each selected field a

group object with a ‘from’ and

‘to’ value input control will be

created.

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 (webcombo)

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 coding.

Page 16: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 16 of 247 z

Business Software for a Changing WorldTM

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.

The next wizard page again

depends on the report

definition. If the report

contains parameters, the

CustomerList.dr does not contain parameters, a page will be shown in which parameters can be selected for

which an input control will be created. 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.

An input control will be

generated for each of the

selection and or parameter

fields.

The generated label for the

input control can be changed

in the labels and alignment

wizard page.

On the same wizard page the

label justification mode can be

chosen by clicking the

corresponding radio in the

‘Justification’ group.

After clicking Next the wizard

makes it possible to set the

sort order of the data

displayed in the details

section of the report.

Page 17: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 17 of 247 z

Business Software for a Changing WorldTM

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.

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.

Page 18: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 18 of 247 z

Business Software for a Changing WorldTM

In the next wizard page a

choice needs to be made

regarding output type and

destination.

Output can be created as PDF,

RTF, TIFF, HTML, JPEG or GIF.

These are – besides Excel – all

the export formats supported

by DataFlex Reports. The

default option is PDF.

Interactive reports can be

made with an HTML output

type.

The graphic formats (TIFF,

JPEG, GIF) produce the output

in one or more files than can

be downloaded or shown in a

viewer control.

Based on the chosen output option (PDF etc.) a

choice can be made between one or more

destination types. The picture shows the options for

PDF. When multiple fields are selected for input

control generation (selection criteria, parameters)

the best choices are “iFrame On Tab in View”, “New Window” or “New Tab” due to the lack of space in the other

two options.

A web report view contains a column layout. The value for the number of columns in the web view can be

entered. Default is 10 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.

The option “Create tool-bar” places the “run report” button on a tool-bar

inside the report view.

Note: The chosen theme needs to support tool-bars. That is why the option

is not pre-selected.

Page 19: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 19 of 247 z

Business Software for a Changing WorldTM

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.

Sorting inside DataFlex

Reports uses a collating

sequence which is maintained

in a file. By default the

DataFlex development

collating sequence file

(df_collate.cfg in the bin

folder) is copied to the

DataFlex Reports design

environment during

installation. The integration

might need to use a different

collating sequence to that of the application and this can be done by specify the path to and the name of the file

with the (different) collating sequence information.

If the report is based on an ODBC data-source the third option can be selected which generates code in the

report object in which a change in the data-source can be programmed.

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 component will be added to the webapp project and

the ‘View” pull-down.

The generated source code contains a cDRReport object to load the DataFlex Reports report. Inside the object a

main event named OnInitializeReport will be present. This is executed when the report loads and in this example

case sends messages to setup report filters and records sorts.

In the SetFilters method values from the input controls for selection criteria (and if present from parameters) are

retrieved. For this a WebGet statement is generated. Since the selection criteria input controls are always in a

from-value to-value way both values are placed in an array type variable which get automatically sorted to get

the lowest value in the first array element. A TODO item is generated to let the developer examine this and

decide if this array sorting should be kept or not. The selection criteria are added to the report data by sending

an AddFilter message.

The SetSortFields is another method to pay attention to. If the “Multi level sort order” option was chosen the

values – to be used with an AddRecordSortField message – are retrieved in a 2-dimensional array consisting of

column and direction pairs.

The method GenerateReport is the starting method for getting the report results. The method is started from

the RunReport method in the web view or from the HTML/Image viewer control. The function returns a string

with a filename (PDF, TIFF) or an array of data or filenames (HTML, GIF, JPEG). In the method the report is

opened and closed. Between this the export options are set to a default which can be changed.

Developers are free to change the layout of the generated web view. Change object references if object names

(such as oReport and oViewer) are changed.

Page 20: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 20 of 247 z

Business Software for a Changing WorldTM

The above screenshots are examples of generated web views for report integration.

Page 21: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 21 of 247 z

Business Software for a Changing WorldTM

2.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 2014

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.

2.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

2.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

2.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

2.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

2.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

Page 22: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 22 of 247 z

Business Software for a Changing WorldTM

2.3.6 Language interface ReportLanguage String sReportId Returns Integer

ReportLanguageList String sReportId Returns Variant

2.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

2.3.8 Preview interface PreviewClick Integer iPos Integer iSectionId String

PreviewCurrentPage Integer iPage

PreviewFind String sString Integer bDown Integer bWholeWord Integer bMatchCase

PreviewFirstPage

PreviewHWND Integer hWnd

PreviewLastPage

PreviewNextPage

PreviewPreviousPage

PreviewShowPage Integer iPage

PreviewZoom Integer iZoom

PreviewZoomChanged Integer iZoom

2.3.9 Print interface PaperOrientation String sReportId Returns Integer

PaperSize String sReportId Returns Integer

ReportPrint String sReportId Integer hPrintDlg

2.3.10 Progress interface ProgressCountPage Integer iPage

ProgressExportPage Integer iPage Integer iTotalPages

ProgressFormatPage Integer iPage Integer iTotalPages

ProgressRecordsRead Integer iRecords

2.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

2.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

Page 23: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 23 of 247 z

Business Software for a Changing WorldTM

2.4 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.

2.4.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.

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

Page 24: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 24 of 247 z

Business Software for a Changing WorldTM

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 psFilterString 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.

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 HTML or to PDF (Portable Document Format). In all five options a variable with the appropriate

settings for the export format needs to be passed. For this use the write only properties pImageExportOptions,

Page 25: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 25 of 247 z

Business Software for a Changing WorldTM

pCSVExportOptions, pXLSExportOptions, pHTMLExportOptions 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

piPreviewPage 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. The minimum size of the

cDRReport object has to be 2 by 2.

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.

The used collating sequence can be queried or set using the psDatabaseCollate method. The method needs to

point to a valid collating sequence file.

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.

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.

Page 26: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 26 of 247 z

Business Software for a Changing WorldTM

2.4.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 ([email protected]).

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.

Page 27: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 27 of 247 z

Business Software for a Changing WorldTM

2.4.3 Properties

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.

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

Page 28: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 28 of 247 z

Business Software for a Changing WorldTM

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

Page 29: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 29 of 247 z

Business Software for a Changing WorldTM

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.

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 printed

Send DisplayReport of oReport

End

End_Procedure

End_Object

Page 30: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 30 of 247 z

Business Software for a Changing WorldTM

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

Page 31: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 31 of 247 z

Business Software for a Changing WorldTM

pCSVExportOptions

Type: drCSVExportOptions structure, see 2.18.1

Default: See 2.18.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.

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

Page 32: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 32 of 247 z

Business Software for a Changing WorldTM

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).

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

Page 33: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 33 of 247 z

Business Software for a Changing WorldTM

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 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, this holds the name of the database (Catalog name). If the data source is RDS, 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).

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

Page 34: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 34 of 247 z

Business Software for a Changing WorldTM

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.

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

Page 35: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 35 of 247 z

Business Software for a Changing WorldTM

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 '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

Page 36: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 36 of 247 z

Business Software for a Changing WorldTM

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

Send OutputReport of oReport

End_Procedure

End_Object

Page 37: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 37 of 247 z

Business Software for a Changing WorldTM

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 or pXLSExportOptions) should be set as well. If not set, the default values (documented in paragraph 2.17.3) 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

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

Page 38: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 38 of 247 z

Business Software for a Changing WorldTM

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.

iField 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).

Sample: Object oReport is a cDRReport

Set psReportName to 'MyReport.dr'

Procedure OnInitializeReport

Forward Send OnInitializeReport

Set psFilterField '' 0 to '{Titles.YearPublished}'

Set peFilterOperator '' 0 to C_drEqual

Set psFilterValue '' 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

Page 39: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 39 of 247 z

Business Software for a Changing WorldTM

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 it is VB Like, not DataFlex. 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).

Sample: Object oReport is a cDRReport

Set psReportName to 'MyReport.dr'

Procedure OnInitializeReport

Forward Send OnInitializeReport

Set psFilterFunction '' 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

Page 40: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 40 of 247 z

Business Software for a Changing WorldTM

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.

iField 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.

Sample: Object oReport is a cDRReport

Set psReportName to 'MyReport.dr'

Procedure OnInitializeReport

Forward Send OnInitializeReport

Set psFilterField '' 0 to '{Titles.YearPublished}'

Set peFilterOperator '' 0 to C_drLessThan

Set psFilterValue '' 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

Page 41: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 41 of 247 z

Business Software for a Changing WorldTM

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.

iField 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).

Sample: Object oReport is a cDRReport

Set psReportName to 'MyReport.dr'

Procedure OnInitializeReport

Forward Send OnInitializeReport

Set psFilterField '' 0 to '{Titles.YearPublished}'

Set peFilterOperator '' 0 to C_drGreaterThanOrEqual

Set psFilterValue '' 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

Page 42: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 42 of 247 z

Business Software for a Changing WorldTM

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

Page 43: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 43 of 247 z

Business Software for a Changing WorldTM

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

Page 44: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 44 of 247 z

Business Software for a Changing WorldTM

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.

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

Page 45: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 45 of 247 z

Business Software for a Changing WorldTM

pHTMLExportOptions

Type: drHTMLExportOptions structure, see 2.18.2

Default: See 2.18.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 'ExportFile.html'

End_Procedure

End_Object

Page 46: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 46 of 247 z

Business Software for a Changing WorldTM

pImageExportOptions

Type: drImageExportOptions structure, see 2.18.3

Default: See 2.18.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 pHTMLExportOptions of oReport to myExportOptions

// exports the report to a file named ExportFile.jpg

Send ExportReport of oReport C_drImage 'ExportFile.jpg'

End_Procedure

End_Object

Page 47: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 47 of 247 z

Business Software for a Changing WorldTM

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.

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

Page 48: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 48 of 247 z

Business Software for a Changing WorldTM

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. 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 stored procedure 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 '' 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

Page 49: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 49 of 247 z

Business Software for a Changing WorldTM

pPDFExportOptions

Type: drPDFExportOptions structure, see 2.18.4

Default: See 2.18.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.

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 'MyPassword' to myExportOptions.sOwnerPassword

Move 'UserPassword' to myExportOptions.sUserPassword

Move C_drLow to myExportOptions.iImageQuality

Move True to myExportOptions.bAllPages

Move 1 to myExportOptions.iPage

Set pPDFExportOptions of oReport to myExportOptions

// exports the report to a file named MyReport.pdf

Send ExportReport of oReport C_drPDF 'MyReport.pdf'

End_Procedure

End_Object

Page 50: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 50 of 247 z

Business Software for a Changing WorldTM

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).

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 iPage

Send RunReport of oReport

Get piPreviewCurrentPage of oReport 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

Page 51: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 51 of 247 z

Business Software for a Changing WorldTM

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.

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 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

Page 52: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 52 of 247 z

Business Software for a Changing WorldTM

phoPrintDialog

Type: Handle

Default: In Windows applications: Object handle of a child object from the cPrintDialog class. In Web applications: 0.

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. Should only be set if the print dialog object needs changes.

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

Page 53: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 53 of 247 z

Business Software for a Changing WorldTM

phPrintDlg

Type: Handle

Default: 0

Arguments: -

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 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

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 <> 0) Begin

Get phPrintDlg Of oPrinterSelection To hPrintDlg

Set phPrintDlg Of oReport to hPrintDlg

End

Send RunReport Of oReport

End_Procedure

End_Object

Page 54: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 54 of 247 z

Business Software for a Changing WorldTM

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

Page 55: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 55 of 247 z

Business Software for a Changing WorldTM

psPreviewCaptionLabel

Type: String

Default: -

Arguments: -

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 and remains empty.

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

Page 56: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 56 of 247 z

Business Software for a Changing WorldTM

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.

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

Page 57: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 57 of 247 z

Business Software for a Changing WorldTM

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.

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

Page 58: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 58 of 247 z

Business Software for a Changing WorldTM

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

Page 59: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 59 of 247 z

Business Software for a Changing WorldTM

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.

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 '' 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

Page 60: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 60 of 247 z

Business Software for a Changing WorldTM

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.

Sample: Object oReport is a cDRReport

Set psReportName to 'MyReport.dr'

Procedure OnInitializeReport

Forward Send OnInitializeReport

Set peRecordSortOrder '' 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

Page 61: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 61 of 247 z

Business Software for a Changing WorldTM

psReportId

Type: String

Default: -

Arguments: -

Description: 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

Page 62: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 62 of 247 z

Business Software for a Changing WorldTM

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.

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

Page 63: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 63 of 247 z

Business Software for a Changing WorldTM

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

Page 64: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 64 of 247 z

Business Software for a Changing WorldTM

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

// Find report in a subfolder named 'reports' of the workspace's data path

Object oReport is a cDRReport

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

Page 65: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 65 of 247 z

Business Software for a Changing WorldTM

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. 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

Page 66: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 66 of 247 z

Business Software for a Changing WorldTM

pRTFExportOptions

Type: drRTFExportOptions structure, see 2.18.5

Default: See 2.18.5

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.

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 'ExportFile.rtf'

End_Procedure

End_Object

Page 67: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 67 of 247 z

Business Software for a Changing WorldTM

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

Page 68: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 68 of 247 z

Business Software for a Changing WorldTM

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

Page 69: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 69 of 247 z

Business Software for a Changing WorldTM

phoStatusPanel

Type: Handle

Default: 0

Arguments: -

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

Page 70: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 70 of 247 z

Business Software for a Changing WorldTM

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).

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

Page 71: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 71 of 247 z

Business Software for a Changing WorldTM

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

Page 72: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 72 of 247 z

Business Software for a Changing WorldTM

pXLSExportOptions

Type: drXLSExportOptions structure, see 2.18.5

Default: See 2.18.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 'MyReport.xlsx'

End_Procedure

End_Object

Page 73: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 73 of 247 z

Business Software for a Changing WorldTM

2.4.4 Events

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

Page 74: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 74 of 247 z

Business Software for a Changing WorldTM

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

Page 75: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 75 of 247 z

Business Software for a Changing WorldTM

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.

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

Page 76: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 76 of 247 z

Business Software for a Changing WorldTM

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

Page 77: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 77 of 247 z

Business Software for a Changing WorldTM

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. 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

Page 78: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 78 of 247 z

Business Software for a Changing WorldTM

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

Page 79: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 79 of 247 z

Business Software for a Changing WorldTM

OnPostDisplayReport

Type: Procedure

Returns: -

Arguments: -

Description: This event is sent by the object at the end of a DisplayReport method.

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

Page 80: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 80 of 247 z

Business Software for a Changing WorldTM

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

Page 81: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 81 of 247 z

Business Software for a Changing WorldTM

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

Page 82: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 82 of 247 z

Business Software for a Changing WorldTM

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

Set psReportName to 'MyReport.dr'

Procedure OnPreOpenReport

Forward Send OnPreOpenReport

Send EmailToSomeOne 'New Print Made, please fetch'

End_Procedure

End_Object

Page 83: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 83 of 247 z

Business Software for a Changing WorldTM

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

Page 84: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 84 of 247 z

Business Software for a Changing WorldTM

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

Page 85: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 85 of 247 z

Business Software for a Changing WorldTM

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.

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

Page 86: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 86 of 247 z

Business Software for a Changing WorldTM

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.

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

Page 87: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 87 of 247 z

Business Software for a Changing WorldTM

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

Page 88: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 88 of 247 z

Business Software for a Changing WorldTM

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.

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

Page 89: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 89 of 247 z

Business Software for a Changing WorldTM

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'

End_Object

Page 90: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 90 of 247 z

Business Software for a Changing WorldTM

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

Page 91: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 91 of 247 z

Business Software for a Changing WorldTM

2.4.5 Methods

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. 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 designer 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

End

Send DisplayReport of oReport

End_Procedure

End_Object

Page 92: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 92 of 247 z

Business Software for a Changing WorldTM

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

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

End

Send DisplayReport of oReport

End_Procedure

End_Object

Page 93: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 93 of 247 z

Business Software for a Changing WorldTM

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

Page 94: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 94 of 247 z

Business Software for a Changing WorldTM

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

Page 95: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 95 of 247 z

Business Software for a Changing WorldTM

DatabaseType

Type: Function

Returns: Integer, representing the type of database used:

C_drDF (DataFlex data source) C_drODBC

C_drSP (Stored Procedure data source)

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 or Stored Procedure data. 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

End

Send CloseReport of oReport

End_Procedure

End_Object

Page 96: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 96 of 247 z

Business Software for a Changing WorldTM

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

Page 97: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 97 of 247 z

Business Software for a Changing WorldTM

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

Page 98: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 98 of 247 z

Business Software for a Changing WorldTM

DefaultCSVExportOptions

Type: Function

Returns: drCSVExportOptions (see 2.18.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

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

Page 99: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 99 of 247 z

Business Software for a Changing WorldTM

DefaultHTMLExportOptions

Type: Function

Returns: drHTMLExportOptions (see 2.18.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

Page 100: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 100 of 247 z

Business Software for a Changing WorldTM

DefaultImageExportOptions

Type: Function

Returns: drImageExportOptions (see 2.18.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. 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

Page 101: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 101 of 247 z

Business Software for a Changing WorldTM

DefaultPDFExportOptions

Type: Function

Returns: drPDFExportOptions (see 2.18.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 sOwnerPassword '' sUserPassword '' iImageQuality C_drLow bAllPages 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

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

Page 102: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 102 of 247 z

Business Software for a Changing WorldTM

DefaultRTFExportOptions

Type: Function

Returns: drRTFExportOptions (see 2.18.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

Page 103: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 103 of 247 z

Business Software for a Changing WorldTM

DefaultXLSExportOptions

Type: Function

Returns: drXLSExportOptions (see 2.18.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. 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

Page 104: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 104 of 247 z

Business Software for a Changing WorldTM

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).

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

Page 105: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 105 of 247 z

Business Software for a Changing WorldTM

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

End

End_Procedure

End_Object

Page 106: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 106 of 247 z

Business Software for a Changing WorldTM

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: 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

Page 107: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 107 of 247 z

Business Software for a Changing WorldTM

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.

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 DRInteger of oReport 123 to sCompare

Move ('return ({company.id} = ' + sCompare + ')') to sFunction

Set psFilterFunction of oReport sReportId to sFunction

Send OutputReport of oReport

End_Procedure

End_Object

Page 108: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 108 of 247 z

Business Software for a Changing WorldTM

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'

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 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

End_Procedure

End_Object

Page 109: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 109 of 247 z

Business Software for a Changing WorldTM

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'

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 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

End_Procedure

End_Object

Page 110: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 110 of 247 z

Business Software for a Changing WorldTM

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. The corresponding export format options need to be set using one of the properties: pCSVExportOptions, pHTMLExportOptions, pImageExportOptions, pPDFExportOptions, 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'

End

End_Procedure

End_Object

Page 111: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 111 of 247 z

Business Software for a Changing WorldTM

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).

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

End

End_Procedure

End_Object

Page 112: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 112 of 247 z

Business Software for a Changing WorldTM

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

End

End_Procedure

End_Object

Page 113: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 113 of 247 z

Business Software for a Changing WorldTM

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

Page 114: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 114 of 247 z

Business Software for a Changing WorldTM

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).

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

Page 115: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 115 of 247 z

Business Software for a Changing WorldTM

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).

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

Page 116: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 116 of 247 z

Business Software for a Changing WorldTM

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. 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

Page 117: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 117 of 247 z

Business Software for a Changing WorldTM

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).

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).

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 cWebVrwReportViewer

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

Page 118: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 118 of 247 z

Business Software for a Changing WorldTM

InitExportStructures

Type: Procedure

Returns: -

Arguments: -

Description: This method will be called from OpenReport and it will initialize the export option structures. This is done in case the source code “forgets” to set the export option structure data. Calls DefaultCSVExportOptions, DefaultImageExportOptions, DefaultHTMLExportOptions, DefaultPDFExportOptions, DefaultRTFExportOptions, or DefaultXLSExportOptions. This method cannot be used before the report OCX object is initialized and a report is opened (OpenReport). Does not need to be executed by an integration program.

Sample: Object oReport is a cDRReport

Set psReportName to 'MyReport.dr'

Procedure InitExportStructures

drPDFExportOptions tOptions

Forward Send InitExportStructures

// override default options

Get pPDFExportOptions to tOptions

Move False to tOptions.bAllPages

Set pPDFExportOptions to tOptions

End_Object

Page 119: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 119 of 247 z

Business Software for a Changing WorldTM

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 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.

Sample: Object oReport is a cDRReport

Set psReportName to 'MyReport.dr'

Function IsFileList String sFileName Returns Boolean

If (Pos('filelist', Lowercase(sFileName)) > 0) Begin

Function_Return True

End

End_Function

End_Object

Page 120: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 120 of 247 z

Business Software for a Changing WorldTM

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

Page 121: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 121 of 247 z

Business Software for a Changing WorldTM

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 property is retrieved and 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. 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'

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

End

End_Procedure

End_Object

Page 122: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 122 of 247 z

Business Software for a Changing WorldTM

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. 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

End

End_Procedure

End_Object

Page 123: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 123 of 247 z

Business Software for a Changing WorldTM

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).

Sample: Use cPrintDialog.Pkg

Object oReport is a cDRReport

Set psReportName to 'MyReport.dr'

End_Object

Object oPrintDialog is a cPrintDialog

End_Object

Object oRunReportButton is a Button

Set Label to 'Run Report'

Procedure OnClick

String sReportId

Integer eOrientation iResult

Handle hPrintDlg

Get OpenReport of oReport to sReportId

If (sReportId <> '') Begin

Get PaperOrientation Of oReport sReportId to eOrientation

Set peOrientation of oPrintDialog to eOrientation

Get PrintDialog of oPrintDialog to iResult

If (iResult = PD_RESULT_PRINT) Begin

Get phPrintDlg of oPrintDialog to hPrintDlg

Send PrintReport Of oReport hPrintDlg

End

End

End_Procedure

End_Object

Page 124: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 124 of 247 z

Business Software for a Changing WorldTM

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).

Sample: Use cPrintDialog.Pkg

Object oReport is a cDRReport

Set psReportName to 'MyReport.dr'

End_Object

Object oPrintDialog is a cPrintDialog

End_Object

Object oRunReportButton is a Button

Set Label to 'Run Report'

Procedure OnClick

String sReportId

Integer eSize iResult

Handle hPrintDlg

Get OpenReport of oReport to sReportId

If (sReportId <> '') Begin

Get PaperSize Of oReport sReportId to eSize

Set pePaperSize of oPrintDialog to eSize

Get PrintDialog of oPrintDialog to iResult

If (iResult = PD_RESULT_PRINT) Begin

Get phPrintDlg of oPrintDialog to hPrintDlg

Send PrintReport Of oReport hPrintDlg

End

End

End_Procedure

End_Object

Page 125: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 125 of 247 z

Business Software for a Changing WorldTM

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).

Sample: Use cPrintDialog.Pkg

Object oReport is a cDRReport

Set psReportName to 'MyReport.dr'

End_Object

Object oPrintDialog is a cPrintDialog

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

End

End_Procedure

End_Object

Page 126: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 126 of 247 z

Business Software for a Changing WorldTM

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).

Sample: Use cPrintDialog.Pkg

Object oReport is a cDRReport

Set psReportName to 'MyReport.dr'

End_Object

Object oPrintDialog is a cPrintDialog

End_Object

Object oRunReportButton is a Button

Set Label to 'Run Report'

Procedure OnClick

Integer iParam

String sReportId

Get OpenReport of oReport to sReportId

If (sReportId <> '') Begin

Get ParameterIdByName of oReport sReportId 'Year' to iParam

Set psParameterValue of oReport sReportId iParameter to 1999

Send OutputReport of oReport

End

End_Procedure

End_Object

Page 127: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 127 of 247 z

Business Software for a Changing WorldTM

ParameterInfo

Type: Function

Returns: tDRParameter, see 2.18.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 of the stored procedure.

Description: Returns the name, type, length, and precision of the N-th stored procedure parameter defined for the data source of a (sub)report or the N-th user defined parameter. 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).

Sample: Object oReport is a cDRReport

Set psReportName to 'MyReport.dr'

End_Object

Object oOpenReportButton is a Button

Set Label to 'Open Report'

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 oParameterName to ReportParamInfo.Name

End

End_Procedure

End_Object

Page 128: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 128 of 247 z

Business Software for a Changing WorldTM

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 of the stored procedure.

Description: Returns the name of the N-th stored procedure parameter defined for the data source of a (sub)report or the N-th user defined parameter. 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).

Sample: Object oReport is a cDRReport

Set psReportName to 'MyReport.dr'

End_Object

Object oOpenReportButton is a Button

Set Label to 'Open Report'

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

End

End_Procedure

End_Object

Page 129: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 129 of 247 z

Business Software for a Changing WorldTM

Parameters

Type: Function

Returns: tDRParameter[], see 2.18.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 with the collected stored procedure information for the data source of a (sub)report or with user defined parameters in 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 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

Page 130: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 130 of 247 z

Business Software for a Changing WorldTM

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 stored procedure parameter defined for the data source of a (sub)report or the N-th user defined parameter in the report. 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'} 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 oOpenReportButton is a Button

Set Label to 'Open Report'

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

Page 131: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 131 of 247 z

Business Software for a Changing WorldTM

PreviewFirstPage

Type: Procedure

Returns: -

Arguments: -

Description: Previews the first report page. 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 oFirstPageButton is a Button

Set Label to 'First Page'

Procedure OnClick

Send PreviewFirstPage of oReport

End_Procedure

End_Object

Page 132: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 132 of 247 z

Business Software for a Changing WorldTM

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).

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 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

Page 133: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 133 of 247 z

Business Software for a Changing WorldTM

PreviewLastPage

Type: Procedure

Returns: -

Arguments: -

Description: Previews the last report page. 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

Page 134: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 134 of 247 z

Business Software for a Changing WorldTM

PreviewNextPage

Type: Procedure

Returns: -

Arguments: -

Description: Previews the next report page, if available. 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 oNextPageButton is a Button

Set Label to 'Next Page'

Procedure OnClick

Send PreviewNextPage of oReport

End_Procedure

End_Object

Page 135: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 135 of 247 z

Business Software for a Changing WorldTM

PreviewPreviousPage

Type: Procedure

Returns: -

Arguments: -

Description: Previews the previous report page, if available. 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

Page 136: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 136 of 247 z

Business Software for a Changing WorldTM

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. 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

Page 137: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 137 of 247 z

Business Software for a Changing WorldTM

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).

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

Page 138: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 138 of 247 z

Business Software for a Changing WorldTM

RDSTableNames

Type: Function

Returns: tDRTableName[], see 2.18.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).

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

Page 139: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 139 of 247 z

Business Software for a Changing WorldTM

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

Page 140: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 140 of 247 z

Business Software for a Changing WorldTM

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.

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

Page 141: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 141 of 247 z

Business Software for a Changing WorldTM

RefreshReport

Type: Procedure

Returns: -

Arguments: -

Description: Refreshes the report by reading the data and formatting the pages. 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

Page 142: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 142 of 247 z

Business Software for a Changing WorldTM

RemoveAllFilters

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 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

End

End_Procedure

End_Object

Page 143: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 143 of 247 z

Business Software for a Changing WorldTM

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).

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

End

End_Procedure

End_Object

Page 144: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 144 of 247 z

Business Software for a Changing WorldTM

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

Send RemoveFilter Of oReport sReportId 0 to bDone

Send OutputReport of oReport

End

End_Procedure

End_Object

Page 145: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 145 of 247 z

Business Software for a Changing WorldTM

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

Send RemoveRecordSortField Of oReport sReportId 0 to bDone

Send OutputReport of oReport

End

End_Procedure

End_Object

Page 146: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 146 of 247 z

Business Software for a Changing WorldTM

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.

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

Page 147: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 147 of 247 z

Business Software for a Changing WorldTM

ReportIdForFunction

Type: Function

Returns: tReportFunctionId, see 2.18.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).

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

Page 148: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 148 of 247 z

Business Software for a Changing WorldTM

ReportIdsForFunction

Type: Function

Returns: tReportFunctionId[], see 2.18.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

Page 149: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 149 of 247 z

Business Software for a Changing WorldTM

ReportIdsForParameter

Type: Function

Returns: tReportParameterId[], see 2.18.10

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

Page 150: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 150 of 247 z

Business Software for a Changing WorldTM

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).

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 iPageCount

Send RunReport of oReport

Get ReportPageCount of oReport to iPageCount

Set Value of oTotalPagesForm to iPageCount

End_Procedure

End_Object

Page 151: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 151 of 247 z

Business Software for a Changing WorldTM

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

Page 152: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 152 of 247 z

Business Software for a Changing WorldTM

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.

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

Page 153: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 153 of 247 z

Business Software for a Changing WorldTM

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'

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

Page 154: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 154 of 247 z

Business Software for a Changing WorldTM

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).

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

Page 155: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 155 of 247 z

Business Software for a Changing WorldTM

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).

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

End

Send OutputReport of oReport

End_Procedure

End_Object

Page 156: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 156 of 247 z

Business Software for a Changing WorldTM

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).

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

End

Send OutputReport of oReport

End_Procedure

End_Object

Page 157: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 157 of 247 z

Business Software for a Changing WorldTM

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

Page 158: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 158 of 247 z

Business Software for a Changing WorldTM

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. 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: 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

Page 159: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 159 of 247 z

Business Software for a Changing WorldTM

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

Get SubReportCount of oReport sReportId to iSubReports

Send Info_Box (Sformat("Number of Subreports: %1", iSubReports))

Send CloseReport of oReport sReportId

End_Procedure

End_Object

Page 160: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 160 of 247 z

Business Software for a Changing WorldTM

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

Showln sReportId

Send EnumerateSubReports of oReport sReportId 1

Send CloseReport of oReport sReportId

End_Procedure

End_Object

Page 161: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 161 of 247 z

Business Software for a Changing WorldTM

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 subreport 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 subreport 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

Send SetParameters of oReport

Send OutputReport of oReport

End_Procedure

End_Object

Page 162: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 162 of 247 z

Business Software for a Changing WorldTM

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).

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

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_Procedure

End_Object

Page 163: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 163 of 247 z

Business Software for a Changing WorldTM

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).

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

Send Clear of oCustomer_DD

Send Request_Read of oCustomer_DD Gt 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

Get OpenReport of oReport to sReportId

Send TableData of oReport sReportId 0 vData

Send DisplayReport of oReport

End_Procedure

End_Object

Page 164: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 164 of 247 z

Business Software for a Changing WorldTM

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).

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

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_Procedure

End_Object

Page 165: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 165 of 247 z

Business Software for a Changing WorldTM

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

Move (CurrentDateTime ()) To tmNow

Get TimeToString Of oReport tmNow To sParameterValue

Get ParameterIdByName Of oReport sReportId 'StartTime' ;

to iParameter

Set psParameterValue of oReport sReportId iParameter ;

to sParameterValue

Send DisplayReport Of oReport

End_Procedure

End_Object

Page 166: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 166 of 247 z

Business Software for a Changing WorldTM

TotalParameterCount

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 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

Page 167: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 167 of 247 z

Business Software for a Changing WorldTM

2.5 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.

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

Page 168: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 168 of 247 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

Page 169: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 169 of 247 z

Business Software for a Changing WorldTM

2.5.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

Page 170: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 170 of 247 z

Business Software for a Changing WorldTM

2.5.2 Events

Activating

Type: Procedure

Returns: -

Arguments: -

Description: This standard event has been augmented to load data by sending a LoadData message. 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

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]

Get piColumnId of oSortOnColumnRef to iColumn

Move "{Customer.Category}" to SortColumnsData[3].sValue[iColumn]

Get piColumnId of oSortOnColumn to iColumn

Move "Category" to SortColumnsData[3].sValue[iColumn]

Get piColumnId of oSortDirectionColumn to iColumn

Move "Ascending" to SortColumnsData[3].sValue[iColumn]

Send InitializeData SortColumnsData

End_Procedure

End_Object

Page 171: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 171 of 247 z

Business Software for a Changing WorldTM

LoadData

Type: Procedure

Returns: -

Arguments: -

Description: This standard event has been augmented to load data by sending a LoadData message. 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

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

Page 172: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 172 of 247 z

Business Software for a Changing WorldTM

2.5.3 Methods

SwitchRows

Type: Procedure

Returns: -

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

Page 173: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 173 of 247 z

Business Software for a Changing WorldTM

2.6 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

Page 174: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 174 of 247 z

Business Software for a Changing WorldTM

2.6.1 Properties The following properties are set for this class.

Property Value pbComboButton True

Page 175: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 175 of 247 z

Business Software for a Changing WorldTM

psAscendingText

Type: String

Default: "Ascending"

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 psAscendingText to "Aufsteigend"

End_Object

Page 176: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 176 of 247 z

Business Software for a Changing WorldTM

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

Page 177: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 177 of 247 z

Business Software for a Changing WorldTM

2.6.2 Events

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

Page 178: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 178 of 247 z

Business Software for a Changing WorldTM

2.6.3 Methods

SortDirection

Type: Function

Returns: Integer

Arguments: Argument Description sSortDirection

Description: Searches the psCaption members of the column combo data for the passed sort direction and returns the 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

Page 179: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 179 of 247 z

Business Software for a Changing WorldTM

2.7 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

Page 180: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 180 of 247 z

Business Software for a Changing WorldTM

2.7.1 Properties

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. 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

Page 181: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 181 of 247 z

Business Software for a Changing WorldTM

2.7.2 Events

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

Page 182: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 182 of 247 z

Business Software for a Changing WorldTM

2.7.3 Methods

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

Page 183: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 183 of 247 z

Business Software for a Changing WorldTM

2.8 cDRExportMenuItem class

2.8.1 Properties

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: Object oExport is a cDRExportMenuItem

Set phoExportOptionsDialog to (oDRExportOptionsDialog)

End_Object

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

Page 184: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 184 of 247 z

Business Software for a Changing WorldTM

2.9 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.

2.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. 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.

Page 185: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 185 of 247 z

Business Software for a Changing WorldTM

2.9.2 Properties

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

Page 186: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 186 of 247 z

Business Software for a Changing WorldTM

2.9.3 Events

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

Page 187: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 187 of 247 z

Business Software for a Changing WorldTM

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 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

Page 188: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 188 of 247 z

Business Software for a Changing WorldTM

2.9.4 Methods

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

Page 189: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 189 of 247 z

Business Software for a Changing WorldTM

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

Page 190: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 190 of 247 z

Business Software for a Changing WorldTM

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

Page 191: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 191 of 247 z

Business Software for a Changing WorldTM

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

Page 192: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 192 of 247 z

Business Software for a Changing WorldTM

2.10 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:

Object oDRPreviewer is a cDRPreviewWindow

Set Size to 228 602

Set Location to 21 5

Set peAnchors to anAll

End_Object

The window_handle of this object needs to be passed to the DataFlex Reports OCX via the COMPreviewHWND

property. This property is private and is not documented as such. In the DRModalPreview dialog object the

passing of the window handle is done as follows:

Procedure Add_Focus Handle hoParent Returns Integer

Handle hoReport hWnd

String sReportId

Forward Send Add_Focus hoParent

Get phoReport to hoReport

If (hoReport <> 0) Begin

Get psReportId of hoReport to sReportId

If (sReportId <> "") Begin

Get Window_Handle of oDRPreviewer to hWnd

If (hWnd <> 0) Begin

Send ShowHideStatusPanel of hoReport True

Set ComPreviewHWND of hoReport to hWnd

Send OnShowPreviewer of hoReport

Send ComReportPreview of hoReport sReportId

Send ShowHideStatusPanel of hoReport False

End

End

End

End_Procedure

Page 193: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 193 of 247 z

Business Software for a Changing WorldTM

2.11 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.

2.11.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 2.7. 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 2.10.

Page 194: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 194 of 247 z

Business Software for a Changing WorldTM

2.11.2 Properties

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

Page 195: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 195 of 247 z

Business Software for a Changing WorldTM

2.11.3 Events

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

Page 196: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 196 of 247 z

Business Software for a Changing WorldTM

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

Page 197: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 197 of 247 z

Business Software for a Changing WorldTM

2.11.4 Methods

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

Page 198: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 198 of 247 z

Business Software for a Changing WorldTM

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

Page 199: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 199 of 247 z

Business Software for a Changing WorldTM

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

Page 200: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 200 of 247 z

Business Software for a Changing WorldTM

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

Page 201: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 201 of 247 z

Business Software for a Changing WorldTM

2.12 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.

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].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

Page 202: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 202 of 247 z

Business Software for a Changing WorldTM

2.12.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

Page 203: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 203 of 247 z

Business Software for a Changing WorldTM

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.

Sample: Object oSortDirectionWebColumn is a cWebColumn

Set psCaption to "Direction"

Set pbServerOnChange to True

Delegate Set phoSortDirectionColumn to Self

End_Object

Page 204: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 204 of 247 z

Business Software for a Changing WorldTM

2.12.2 Events

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].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

Page 205: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 205 of 247 z

Business Software for a Changing WorldTM

2.12.3 Methods

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

Page 206: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 206 of 247 z

Business Software for a Changing WorldTM

2.13 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.

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

Page 207: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 207 of 247 z

Business Software for a Changing WorldTM

2.13.1 Properties The following properties are set and defined for this class.

Property Value pbSortable False piWidth 60

Page 208: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 208 of 247 z

Business Software for a Changing WorldTM

psAscendingText

Type: String

Default: "Ascending"

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

Page 209: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 209 of 247 z

Business Software for a Changing WorldTM

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

Page 210: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 210 of 247 z

Business Software for a Changing WorldTM

2.13.2 Events

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 cDRSortDirectionColumn

Set psCaption to "Direction"

Set piWidth to 40

Procedure AddComboValues

Send AddComboItem C_drAscending "Aufsteigend"

Send AddComboItem C_drDescending "Absteigend"

End_Procedure

End_Object

Page 211: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 211 of 247 z

Business Software for a Changing WorldTM

2.14 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.

The following example shows the usage of the cWebDRReportViewer class.

Object oReport is a cDRReport

Set psReportName to "Report.dr"

Function GenerateReportHTML Returns String[]

String sReportId

String[] sData

Integer iPages iArgSize

Get OpenReport to sReportId

If (sReportId <> "") Begin

Get_Argument_Size to iArgSize

Get ComReportHTMLPreview sReportId (iArgSize - 10) to sData

Send CloseReport sReportId

End

Function_Return sData

End_Function

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

Page 212: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 212 of 247 z

Business Software for a Changing WorldTM

2.14.1 Properties The following properties are set for this class.

Property Value pbFillHeight True piColumnSpan 0 psJSClass DR.WebReportViewer

Page 213: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 213 of 247 z

Business Software for a Changing WorldTM

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 cDRReport

Set psReportName to "Report.dr"

Function GenerateDownloadLinks Returns String[]

String sReportId sCacheFolder sHEXUUID sBaseName

String[] sFileNames

DRImageExportOptions ImageExportOptions

Integer iPages iPage iElement

Get OpenReport to sReportId

If (sReportId <> "") Begin

Get ReportPageCount to iPages

Move (ResizeArray(sFileNames, iPages)) to sFileNames

Get ReportsCacheFolder to sCacheFolder

Get RandomHexUUID to sHEXUUID

Move (sCacheFolder + sHEXUUID) to sBaseName

Move C_DRJPEG to ImageExportOptions.iImageType

Move False to ImageExportOptions.bMultiPage

For iPage from 1 to iPages

Move iPage to ImageExportOptions.iPage

Set pImageExportOptions to ImageExportOptions

Move (Sformat("%1-Page%2.jpg", sBaseName, iPage)) ;

to sFileNames[iElement]

Send ExportReport C_DRImage sFileNames[iElement]

Get DownloadURL of ghoWebResourceManager ;

sFileNames[iElement] to sFileNames[iElement]

Increment iElement

Loop

Send CloseReport sReportId

End

Function_Return sFileNames

End_Function

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

Page 214: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 214 of 247 z

Business Software for a Changing WorldTM

piPage

Type: Integer

Returns: 0

Arguments: -

Description: Can be set to navigate to a certain page. 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

Page 215: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 215 of 247 z

Business Software for a Changing WorldTM

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

Page 216: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 216 of 247 z

Business Software for a Changing WorldTM

phoReport

Type: Handle

Default: 0

Arguments: -

Description: This property needs to be set to the object id of a cDRReport object.

Sample: Object oViewer is a cWebDRReportViewer

Set phoReport to oReport

End_Object

Page 217: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 217 of 247 z

Business Software for a Changing WorldTM

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.

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

Page 218: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 218 of 247 z

Business Software for a Changing WorldTM

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

Page 219: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 219 of 247 z

Business Software for a Changing WorldTM

pbServerOnPageChange

Type: Boolean

Default: False

Arguments: -

Description: Can be set to true to be able to respond to a page change.

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

Page 220: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 220 of 247 z

Business Software for a Changing WorldTM

pbShowPrintButton

Type: Boolean

Default: True

Arguments: -

Description: To show a print button in the floating tool-bar in the previewer.

Sample: Object oViewer is a cWebDRReportViewer

Set phoReport to oReport

Set pbShowPrintButton to False

End_Object

Page 221: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 221 of 247 z

Business Software for a Changing WorldTM

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

Page 222: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 222 of 247 z

Business Software for a Changing WorldTM

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. 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

Page 223: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 223 of 247 z

Business Software for a Changing WorldTM

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

Page 224: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 224 of 247 z

Business Software for a Changing WorldTM

2.14.2 Events

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 as an eDataType and 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

Page 225: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 225 of 247 z

Business Software for a Changing WorldTM

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. This event can also be handled by the client by setting the psClientOnOpenReport property to the name of a client-side event handler. This does not require pbServerOnOpenReport to be set.

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

Page 226: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 226 of 247 z

Business Software for a Changing WorldTM

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. This event can also be handled by the client by setting the psClientOnPageChange property to the name of a client-side event handler. This does not require pbServerOnPageChange to be set.

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

Page 227: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 227 of 247 z

Business Software for a Changing WorldTM

2.14.3 Methods

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

Page 228: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 228 of 247 z

Business Software for a Changing WorldTM

PrevPage

Type: Procedure

Default: -

Arguments: -

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

Page 229: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 229 of 247 z

Business Software for a Changing WorldTM

PrintReport

Type: Procedure

Default: -

Arguments: -

Description: Can be used to instruct the control to navigate to print the report.

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

Page 230: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 230 of 247 z

Business Software for a Changing WorldTM

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.

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

Page 231: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 231 of 247 z

Business Software for a Changing WorldTM

2.15 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.

2.15.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

2.15.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.

2.15.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.

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.

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.

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.

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.

Page 232: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 232 of 247 z

Business Software for a Changing WorldTM

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.

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.

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.

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%.

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.

2.15.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.

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.

2.15.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.

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.

Page 233: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 233 of 247 z

Business Software for a Changing WorldTM

2.15.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.

Page 234: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 234 of 247 z

Business Software for a Changing WorldTM

2.16 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.

2.16.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.

The system will temporarily create a cPrintDialog object.

Send PrintReport of oReport 0

2.16.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 temporarily instantiating an object of the cPrintDialog

class. 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

2.16.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

Send OutputReport of oReport

Page 235: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 235 of 247 z

Business Software for a Changing WorldTM

2.17 Constants

2.17.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.

2.17.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

2.17.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

2.17.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

2.17.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

2.17.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.

Constant Value C_drNormal 0

Page 236: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 236 of 247 z

Business Software for a Changing WorldTM

Constant Value C_drOutline 1 C_drThumbs 2 C_drFullScreen 3

2.17.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

2.17.8 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

2.17.9 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 - 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 -

Page 237: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 237 of 247 z

Business Software for a Changing WorldTM

Constant Supported 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 - LANG_SWEDISH Yes LANG_SYRIAC - LANG_TAMIL - LANG_TATAR - LANG_TELUGU - LANG_THAI - LANG_TURKISH - LANG_UKRAINIAN - LANG_URDU - LANG_UZBEK - LANG_VIETNAMESE -

2.17.10 Sort order One of the following constants can be passed as the eSortOrder parameter for the AddRecordSortField message.

Page 238: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 238 of 247 z

Business Software for a Changing WorldTM

Constant Value C_drAscending 1 C_drDescending 2

2.17.11 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

2.17.12 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 4.0 C_DR_OCX_NAME DataFlex Reports 2014 Developer Edition API.ocx

2.17.13 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

2.17.14 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

Page 239: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 239 of 247 z

Business Software for a Changing WorldTM

2.18 Structs

2.18.1 CSV export options The name of this struct is drCSVExportOptions. It is used by the InitExportStructures 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

2.18.2 HTML export options The name of this structure is drHTMLExportOptions. It is used by the InitExportStructures 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

2.18.3 Image export options The name of this structure is drImageExportOptions. It is used by the InitExportStructures and

pImageExportOptions.

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

2.18.4 PDF export options The name of this struct is drPDFExportOptions. It is used by the InitExportStructures and pPDFExportOptions.

Member Type Description Default Value iPageMode Integer One of:

C_drNormal

C_drOutline

C_drThumbs

C_drFullScreen

C_drNormal

sOwnerPassword String Password for altering the PDF. ''

sUserPassword String Password for opening the PDF. ''

iImageQuality One of: C_drLow

C_drHigh

C_drLow

bAllPages Boolean Export all pages or single page True iPage Integer Page number of single page to export 0

Page 240: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 240 of 247 z

Business Software for a Changing WorldTM

2.18.5 RTF export options The name of this structure is drRTFExportOptions. It is used by the InitExportStructures 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

2.18.6 Excel export options The name of this structure is drXLSExportOptions. It is used by the InitExportStructures 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

2.18.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.

2.18.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.

2.18.9 Parameter information The name of this struct is tDRParameter. It is used by the ParameterInfo and Parameters methods.

Member Type Description sName String The parameter name. iType Integer The datatype of the parameter. iLength Integer The length of the parameter datatype.

Page 241: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 241 of 247 z

Business Software for a Changing WorldTM

Member Type Description iPrecision Integer The precision of the parameter datatype.

2.18.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.

Page 242: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 242 of 247 z

Business Software for a Changing WorldTM

3. 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 2014 Developer Edition API.ocx

The DataFlex Reports API 4.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 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\4.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 2014 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”.

Page 243: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 243 of 247 z

Business Software for a Changing WorldTM

4. 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.

Page 244: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 244 of 247 z

Business Software for a Changing WorldTM

Index

Activating (event) ................................................. 170 AddComboValues (event) .................................... 177 AddFilter (method) ......................................... 91, 238 Adding library to workspace ..................................... 6 AddRecordSortField (method) ....................... 92, 237 C_DR_OCX_NAME (constant) .............................. 238 C_DR_OCX_VERSION (constant) .................. 120, 238 C_drAscending (constant) ................ 60, 92, 177, 238 C_drCountPages (constant) ........................... 88, 236 C_drCSV (constant) ..................... 37, 76, 80, 110, 235 C_drDescending (constant) .............. 60, 92, 177, 238 C_drDF (constant) ........................................... 95, 235 C_drEqual (constant) ................................ 40, 91, 238 C_drExecution (constant) ............................... 88, 236 C_drExecutionPlan (constant) ....................... 88, 236 C_drFormatPages (constant) ......................... 88, 236 C_drFullScreen (constant) ............................ 236, 239 C_drGIF (constant)........................................ 235, 239 C_drGreaterThan (constant) .................... 40, 91, 238 C_drGreaterThanOrEqual (constant) ...... 40, 91, 238 C_drHigh (constant) ..................................... 236, 239 C_drHTML (constant) ................. 37, 76, 80, 110, 235 C_drImage (constant) ................. 37, 76, 80, 110, 235 C_drJPEG (constant) ..................................... 235, 239 C_drLessThan (constant) .......................... 40, 91, 238 C_drLessThanOrEqual (constant) ............ 40, 91, 238 C_drLow (constant) ...................................... 236, 239 C_drNone (constant) ...................................... 40, 238 C_drNormal (constant) ................................. 235, 239 C_drNoSheets (constant) ............................. 238, 240 C_drNotEqual (constant) .......................... 40, 91, 238 C_drNowhere (constant) ................................ 87, 235 C_drObject (constant) .................................... 87, 235 C_drODBC (constant) ..................... 95, 151, 154, 235 C_drOutline (constant) ................................. 236, 239 C_drPDF (constant) .................... 37, 76, 80, 110, 235 C_drPNG (constant) ...................................... 235, 239 C_DRPREVIEW_EMBEDDED (constant) .................. 57 C_DRPREVIEW_MODAL (constant)............ 55, 56, 57 C_DRPREVIEW_TOOLPANEL (constant) ... 55, 56, 57,

158, 184, 193 C_DRPREVIEW_VIEW (constant) 54, 55, 56, 57, 158,

184 C_drRDS (constant) ...................................... 155, 235 C_drReadRecords (constant) ......................... 88, 236 C_drReportOpen (constant)........................... 88, 236 C_drRTF (constant) ..................... 37, 76, 80, 110, 235 C_drSection (constant) ................................... 87, 235 C_drSheetsPage (constant) .......................... 238, 240 C_drSortRecords (constant) ........................... 88, 236

C_drSP (constant) ........................... 95, 151, 156, 235 C_drThumbs (constant) ................................ 236, 239 C_drTIFF (constant) ...................................... 235, 239 C_drXLS (constant) ..................... 37, 76, 80, 110, 235 C_drXLS2003 (constant) ............................... 238, 240 C_drXLS2007 (constant) ............................... 238, 240 C_USEMAINDRREPORTID (constant) ............. 25, 235 CancelReport (method) ........................................... 93 cCJGridColumn (class) .................................. 167, 173 CDbl (function) ...................................................... 108 cDRCurrentPageMenuItem (class) ....................... 179 cDRExportMenuItem (class) ................................. 179 cDRFirstPageMenuItem (class) ............................ 179 cDRLastPageMenuItem (class) ............................. 179 cDRMenuItem (class).................................... 179, 193 cDRNextPageMenuItem (class) ............................ 179 cDRPreview (class) .......................... 54, 158, 179, 184 cDRPreviewWindow (class) ............ 56, 184, 192, 193 cDRPreviousPageMenuItem (class) ..................... 179 cDRPrintMenuItem (class).................................... 179 cDRRefreshMenuItem (class) ............................... 179 cDRReport (class) ........................................ 19, 23–25 cDRSortColumnsGrid (class) ......................... 167, 173 cDRSortDirectionsGridColumn (class) ......... 167, 173 cDRToolPanelPreview (class) ............... 158, 179, 193 cDRWebSortColumnsGrid (class) ................. 201, 206 cDRWebSortDirectionColumn (class) .......... 201, 206 cDRZoomMenuItem (class) .................................. 179 CInt (function) ....................................................... 107 CloseReport (method) ...................................... 25, 94 Comma Separated Values .............................. See CSV cPrintDialog (class) ............................. 23, 52, 53, 234 CStr (function) ....................................................... 109 CSV ............................................................... 24, 31, 37

Export options ...................................... 31, 98, 239 cWebDRReportViewer (class) .............................. 211 Database Types ..................................................... 235 DatabaseType (method) ........................... 23, 95, 235 DateSerial (function)............................................. 106 DateTimeToString (method) .......................... 96, 106 DateToString (method)................................... 97, 106 DefaultCSVExportOptions (method) ........ 31, 98, 118 DefaultHTMLExportOptions (method) .... 45, 99, 118 DefaultImageExportOptions (method) .. 46, 100, 118 DefaultPDFExportOptions (method)...... 49, 101, 118 DefaultRTFExportOptions (method) ...... 66, 102, 118 DefaultXLSExportOptions (method) ...... 72, 103, 118 Deploying the runtime ......................................... 242 DF_OPEN_PATH ....................................................... 32 DisplayReport (method) ..................... 24, 74, 79, 104

Page 245: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 245 of 247 z

Business Software for a Changing WorldTM

DisplayStatusPanel (method) ............................... 105 drCSVExportOptions (struct) .................... 31, 98, 239 DRDate (method) .................................................. 106 drHTMLExportOptions (struct) ................ 45, 99, 239 drImageExportOptions (struct) ...... 46, 100, 235, 239 DRInteger (method).............................................. 107 DRNumber (method) ............................................ 108 drPDFExportOptions (struct) .................. 49, 101, 239 drRTFExportOptions (struct) .................. 66, 102, 240 DRStatusPanel .......................................................... 69 DRString (method) ................................................ 109 drXLSExportOptions (struct) .......... 72, 103, 238, 240 Error_Report ..................................................... 25, 75 Excel .................................................................. 24, 37

Export options .................................... 72, 103, 240 New sheet options ........................................... 238 Versions............................................................. 238

Export formats ...................................................... 235 Export options

CSV ........................................................ 31, 98, 239 Excel .................................................... 72, 103, 240 HTML ..................................................... 45, 99, 239 Image................................................... 46, 100, 239 PDF ...................................................... 49, 101, 239 RTF ....................................................... 66, 102, 240

ExportReport (method) ..... 24, 76, 80, 110, 232, 235 Filter operators ............................................... 40, 238 FilterCount (method) ............................................ 111 FiltersDefined (method ........................................ 112 FunctionCount (method) ................................ 24, 113 FunctionIdByName (method) ........................ 24, 114 FunctionLength (method) .................................... 115 FunctionType (method) ........................................ 116 GIF .......................................... See C_drGIF (constant) HitTest ................................................................... 235 HTML ................................................................. 24, 37

Export options ...................................... 45, 99, 239 HTMLPreviewData (method) ............................... 117 Image

Export options .................................... 46, 100, 239 Formats ............................................................. 235

InitExportStructures (method) ............................. 118 Integration Wizard ..................................................... 7 intermediate files .................................................... 23 IsEnabled (event) .................................................. 181 IsFileList (method) ................................................ 119 JPEG ..................................... See C_drJPEG (constant) Language ............................................... 11, 19, 25, 26

Constants .......................................................... 236 LoadData (method) .............................................. 171 Maximize_Icon ......................................................... 27 NextPage (method) .............................................. 227 oCommandBars (object) ...................................... 231 OCX .......................................................................5, 21 OCX name.............................................................. 238

OCX version ................................................... 120, 238 OCXVersion (method) ........................................... 120 oDRStatusPanel (object) .......................................... 69 oDRToolbar (object) ............................................. 231 OnClickActionLink (event) ............................ 217, 224 OnClosePreviewer (event) ...................................... 73 OnDisplayReport (event) .......................... 29, 74, 104 OnError (event) ........................................... 25, 44, 75 OnExportReport (event) ........................... 29, 76, 110 OnFill (event)......................................................... 210 OnInitializeReport (event) ........................ 29, 77, 121 OnOpenReport (event) ................................. 218, 225 OnPageChange (event) ......................................... 226 OnPageChanged (event)

cDRPreview (class) ............................................ 186 cDRReport (class) ................................................. 78 cDRToolPanelPreview (class) ........................... 195

OnPostDisplayReport (event) ......................... 79, 104 OnPostExportReport (event) .......................... 80, 110 OnPostPrintReport (event)............................. 81, 136 OnPreOpenReport (event) ...................................... 82 OnPrintReport (event) .............................. 29, 83, 136 OnProgressFormatPage (event) ....................... 24, 85 OnProgressRecordsRead (event) ..................... 24, 84 OnReportInfo (event) ....................................... 68, 86 OnReportPreviewClick (event) ....................... 87, 235 OnReportStatistics (event) ............................. 88, 236 OnSetSortColumns (event) .................................. 204 OnShowPreviewer (event) ...................................... 89 OnZoomChanged (event)

cDRPreview (class) ............................................ 187 cDRReport (class) ................................................. 90 cDRToolPnalePreview (class) ........................... 196

OpenReport (method) ...................... 23, 77, 121, 157 Operators .................................... See Filter operators oReport (object).................................................... 232 OutputReport (method) ............................... 122, 157 PaperOrientation (method) ................................. 123 PaperSize (method) .............................................. 124 ParameterCount (method) ............................. 25, 125 ParameterIdByName (method) ........................... 126 ParameterInfo (method) .............................. 127, 240 ParameterName (method) ............................. 25, 128 Parameters .......................................................... 9, 16 Parameters (method) ................................... 129, 240 ParameterType (method) ............................... 25, 130 pbAllowMaximizeView (property) .......................... 27 pbAutoLocateDFFiles (property) ........ 23, 24, 28, 119 pbCanceled (property) ............................... 25, 29, 93 pbCancelIfError (property) ............................... 25, 30 pbDisplayError (property) .......................... 25, 34, 75 pbHasErrors (property) .................................. 44, 157 pbServerOnClickActionLink (property) ........ 217, 224 pbServerOnOpenReport (property) ............ 218, 225 pbServerOnPageChange (property) ............ 219, 226

Page 246: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 246 of 247 z

Business Software for a Changing WorldTM

pbShowInformationMessages (property) ....... 68, 86 pbShowPrintButton (property) ............................ 220 pbShowStatusPanel (property) .......... 24, 67, 69, 105 pbShowToolbar (property) ................................... 221 pCSVExportOptions (property) .. 25, 31, 37, 110, 239 PDF .................................................................... 24, 37

export options ................................................... 239 Export options ............................................ 49, 101

PDF image qualities .............................................. 236 PDF page modes ................................................... 235 PDFExportOptions (struct) ........................... 235, 236 peExportType (property) ......................................... 37 peFilterOperator (property) ............... 38, 40, 41, 238 peMode (property) ............................................... 213 peOutputDestination (property) ..................... 24, 47 pePreviewStyle (property) ............................. 57, 158 peRecordSortOrder (property) ............................... 60 peToolbarAlignment (property) ........................... 222 phcPreviewer (property) .......... 54, 56, 158, 184, 193 phoExportOptionsDialog (property) ....................... 36 phoPreviewContainer (property) ......... 56, 78, 89, 90 phoPrintDialog (property) ................................ 52, 58 phoReport (property) ........................................... 216

cDRMenuItem (class) ....................................... 180 cDRPreview (class) ............................................ 185 cDRToolPanelPreview (class) ........................... 194 Template ........................................................... 231

phoSortDirectionColumn (property) ................... 203 phoStatusPanel (property) ............................... 24, 69 phPrintDlg (property) .............................................. 53 pHTMLExportOptions (property) ...... 25, 37, 45, 110,

239 pImageExportOptions (property) ..... 24, 37, 46, 110,

239 piPage (property) .................................................. 214 piPageCount (property) ........................................ 215 piPreviewCurrentPage (property)........................... 50 piPreviewPage (property)

cDRReport (class) ................................................. 25 piPreviewZoom (property) ...................................... 51 piReportLanguage (property) ................................. 62 piZoom (property) ................................................ 223 PNG ....................................... See C_drPNG (constant) Popup_Modal .......................................................... 57 Popup_State ............................................................ 69 Portable Document Format ........................... See PDF pPDFExportOptions (property) .. 25, 37, 49, 110, 236 PreviewFind (method)

cDRReport (class) ............................................... 132 PreviewFirstPage (method)

cDRPreview (class) ............................................ 188 cDRReport (class) ........................................ 25, 131 cDRToolPanelPreview (class) ........................... 197

PreviewLastPage (method) cDRPreview (class) ............................................ 189

cDRReport (class) ........................................ 25, 133 cDRToolPanelPreview (class) ........................... 198

PreviewNextPage (method) cDRPreview (class) ............................................ 190 cDRReport (class) ................................ 25, 134, 231 cDRToolPanelPreview (class) ........................... 199

PreviewPreviousPage (method) cDRPreview (class) ............................................ 191 cDRReport (class) ........................................ 25, 135 cDRToolPanelPreview (class) ........................... 200

PrevPage (method) ............................................... 228 Printing .................................................................. 234 PrintReport (method)

cDRReport (class) ................................ 24, 136, 234 cWebDRReportViewer (class) .......................... 229

PrintToDefaultPrinter (method) .................. 137, 234 pRTFExportOptions (property) ....................... 66, 240 psAscendingText (property) ......................... 175, 208 psCaption (property) ............................................ 178 psClientOnClickActionLink (property).................. 224 psClientOnOpenReport (property) ...................... 225 psClientOnPageChange (property) ...................... 226 psDatabaseConnection (property) .................. 23, 32 psDatabaseName (property) ............................ 23, 33 psDescendingText (property) ....................... 176, 209 psExportFileName (property) ................................. 35 psFilterField (property) ............................... 38, 40, 41 psFilterFunction (property) ..................................... 39 psFilterString (property) .......................................... 24 psFilterValue (property) ............................. 38, 40, 41 psFunction (property)....................................... 24, 42 psFunctionName (property) ............................. 24, 43 psParameterValue (property) .......................... 25, 48 psPreviewCaptionLabel (property) ......................... 55 psPrinterName (property) .............................. 58, 234 psRecordSortField (property).................................. 59 psReportId (property) ..................................... 61, 235 psReportLocation (property) .................................. 63 psReportName (property) ................................ 23, 64 psReportPath (property) ......................................... 65 psTableName (property) .................................. 23, 70 psTableSchema (property) ............................... 23, 71 pXLSExportOptions (property) ... 25, 37, 72, 110, 240 RDS ................................................................ 138, 155 RDSTableNames (method) ........................... 138, 240 RecordSortCount (method) .................................. 140 RefreshReport (method) ....................................... 141 RemoveAllFilters (method) .................................. 142 RemoveAllRecordSortFields (method) ................ 143 RemoveFilter (method) ........................................ 144 RemoveRecordSortField (method) ...................... 145 Report ID ............................................................... 235 Report statistics .................................................... 236 ReportCacheFileName (method) ......................... 146 ReportIdForFunction (method) .................... 147, 240

Page 247: DataFlex Reports Developer Guide - Data Access Europe BVdemo.dataaccess.eu/livevisualreportwriter/DataFlex Reports 2014... · DataFlex Reports Developer Guide. ... DataFlex Reports

+31 74 2555 609 [email protected] www.dataaccess.euData Access Europe B.V. / Lansinkesweg 4 / 7553 AEHengelo, The Netherlands

Page 247 of 247 z

Business Software for a Changing WorldTM

ReportIdsForFunction (method) .................. 148, 240 ReportIdsForParameter (method) ............... 149, 241 ReportObject (method) ................................ 182, 183 ReportPageCount (method) ................................. 150 ReportQuery (method) ......................................... 151 ReportsCacheFolder (method) ............................ 153 ReportsFolder (method) ................................. 65, 152 ReportUsesODBC (method) ................................. 154 ReportUsesRDS (method) .................................... 155 ReportUsesStoredProcedures (method) ..... 125, 156 RTF ............................................................................ 37

Export options .................................... 66, 102, 240 RunReport (method) ............................................ 157 SetDefaultPreviewerClass (method) ............ 158, 193 ShowReport (method) .......................................... 230 Sort order .............................................................. 237 SortColumnSet (method) ..................................... 205 SortDirection (method) ........................................ 178 SQL ......................................................................... 151 SubReportCount (method) ............................. 24, 159

SubReportId (method).......................................... 160 SubReportID (method) ............................................ 24 SubReportIDByName (method) ........................... 161 Support .................................................................. 243 SwitchRows (method) .......................................... 172 TableCount (method) ..................................... 23, 162 TableData (method) ............................................. 163 tDRParameter (struct) .......................... 127, 129, 240 tDRTableName (struct) ......................................... 240 Templates .............................................................. 231 TestFilterFunction (method) .......................... 24, 164 TIFF ....................................... See C_drTIFF (constant) TimeToString (method) ........................................ 165 TotalParameterCount (method) .......................... 166 Translation ............................................................... 26 tReportFunctionId (struct) ................................... 240 tReportParameterId (struct) ................................ 241 XLS .................................................................See Excel XLSX ...............................................................See Excel


Recommended