Using the crystal rdc interface in visual dataflex
This presentation is the property of its rightful owner.
Sponsored Links
1 / 17

Using the Crystal RDC Interface in Visual DataFlex PowerPoint PPT Presentation


  • 98 Views
  • Uploaded on
  • Presentation posted in: General

Using the Crystal RDC Interface in Visual DataFlex. John J Tuohy Data Access Worldwide. What does the Crystal class do?. Allows you to run a Crystal Report from within your VDF Application At the most basic level you want to select a report and run it

Download Presentation

Using the Crystal RDC Interface in Visual DataFlex

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Using the crystal rdc interface in visual dataflex

Using the Crystal RDC Interface in Visual DataFlex

John J Tuohy

Data Access Worldwide


What does the crystal class do

What does the Crystal class do?

  • Allows you to run a Crystal Report from within your VDF Application

  • At the most basic level you want to select a report and run it

    • Just select a Report, select an output destination and run it

  • In more advanced cases you want to dynamically change the report at runtime

    • Change the sort order

    • Change record and group selection formulas

    • Change formula and parameter values

    • Change tables being used in a report

    • Generate and use dynamic (non-table based) data


How the current crystal class works

How the current Crystal class works

  • CrystalReport class

  • Based on crpe32.dll API

  • Can be distributed royalty free

  • Implemented using VDF’s External_functions

  • Uses a flat Interface which passes complex data

  • Works great


Why do we need to change this

Why do we need to change this?

  • Business Objects / Crystal really wants you to stop using it!

  • As of Crystal Reports XI

    • It is no longer supported

    • Crystal XI claims it’s not even there (it is)

    • It is very old technology that will not be updated or fixed

  • It has been replaced with their RDC API


How does the new interface work

How does the new interface work?

  • Based on their Report Design Component (RDC) API

  • RDC is a COM interface

    • Imported via FlexCom2

    • Uses

      • Craxddrt.dll – automation library

      • CRViewer.dll – activeX Report viewer

      • CDO32.dll – automation library

  • Can be distributed royalty free

  • Uses the RDC object model

    • Lots of objects with simple interfaces


Implementation plans

Implementation plans

  • Provide a new class, cCrystal, which will wrap all of the RDC COM objects

  • Make it easy to get at the most commonly needed COM objects

    • Simplify the object aggregation process

  • Use the standard RDC object model and interface

  • Provide a simple way to view reports within an application

  • Provide helper interfaces to make it easy to do the most commonly required tasks

  • For more complicated tasks, provide good samples to show how to do it.

  • Get out of the way!


What are the benefits of using the new class

What are the benefits of using the new class?

  • You are up to date

  • You have more features at your disposal (e.g. CDO)

  • You are using the industry standard method for working with Crystal

    • This lets you use the Crystal Documentation, Crystal Newsgroups, etc. to get development assistance.

  • Once you “get it”, it's not that hard

  • The skills you learn can be applied to other COM solutions


Compatibility issues

Compatibility issues

  • The new class is not designed to be compatible with the old class

  • You can still use CRPE32 for your old reports

  • Options we are considering for providing a “compatibility layer”

    • None at all

    • Could provide a limited compatibility layer

    • Could provide a complete compatibility layer

  • Give us your feedback on this issue.


The new class structure interface

The new class structure/interface

  • cCrystal class

    • Property Integer peOutputDestination

    • Property String psReportName

    • Procedure RunReport

    • Procedure OnInitializeReport handle hoReport

    • Procedure PrintReport handle hoReport

    • Procedure PreviewReport handle hoReport

    • Procedure ExportReport handle hoReport


Samples print to viewer

Samples: Print to viewer

//

// Simple Print (default is print to preview)

//

Object oCrystalReport is a cCrystal

Set psReportName to "CustLst.rpt"

End_Object


Samples select output destination

Samples: Select output destination

Object oCrystalReport is a cCrystal

Set psReportName to "CustLst.rpt"

End_Object

Object oPrintToScreen is a Button

Procedure OnClick

Set peOutputDestination of oCrystalReport to PRINT_TO_WINDOW

Send RunReport of oCrystalReport

End_Procedure

End_Object

Object oPrintToExport is a Button

Procedure OnClick

Set peOutputDestination of oCrystalReport to PRINT_TO_FILE

Send RunReport of oCrystalReport

End_Procedure

End_Object


Samples select printer via prompt

Samples: Select printer via prompt

Object oCrystalReport is a cCrystal

Set psReportName to "CustLst.rpt"

Procedure OnInitializeReport Handle hoReport

Forward Send OnInitializeReport hoReport

End_Procedure

Procedure PrintReport handle hoReport

Set piPrinterPrompt of hoReport to True

End_Procedure

End_Object

Object oButton1 is a Button

Procedure OnClick

Set peOutputDestination of oCrystalReport to PRINT_TO_PRINTER

Send RunReport of oCrystalReport

End_Procedure

End_Object


Samples output to predefined printer

Samples: Output to predefined printer

Object oCrystalReport is a cCrystal

Set psReportName to "CustLst.rpt"

Set peOutputDestination of oCrystalReport to PRINT_TO_PRINTER

Procedure OnInitializeReport Handle hoReport

Forward Send OnInitializeReport hoReport

End_Procedure

Procedure PrintReport Handle hoReport

Send ComSelectPrinterof hoReport "winspool" "Lexmark 3320" "LPT1:"

Set ComPaperOrientationof hoReport to crLandscape

Set ComPaperSizeof hoReport to crPaperLetter

Set piPrinterCopiesof hoReport to 2

Set pbPrinterCollateof hoReport to FALSE

Forward Send PrintReport hoReport

End_Procedure

End_Object


Samples output to mapi no prompt

Samples: Output to MAPI – no prompt

Object oCrystalReport is a cCrystal

Set psReportName to "CustLst.rpt"

Set peDestination to Print_to_File

Procedure ExportReport Handle hoReport

Handle hoExport

  Get ExportObject of hoReport to hoExport

  Set pbPromptExportof hoReport to False

Set ComDestinationTypeof hoExport to crEDTEMailMAPI

Set ComMailToListof hoExport to "[email protected]"

Set ComMailSubjectof hoExport to "Testing"

Set ComMailMessageof hoExport to "This is a test"

Set ComExportFileNameof hoExport to "MyReport.pdf"

Set ComFormatTypeof hoExport to crEFTPortableDocFormat

  Forward Send ExportReport hoReport

  End_Procedure

End_Object


Samples assign selections formulas and sorts

Samples: Assign selections, formulas and sorts

Object oCrystalReport is a cCrystal

Set psReportName to "CustLst.rpt"

Procedure OnInitializeReport Handle hoReport

:

// set record selection formula

Get Value of oForm1 to sState

Set ComRecordSelectionFormula of hoReport to ('{Cust.State}="' * sState * '"}')

// set a formula

Send AssignFormula of hoReport "Company Name" '"Data Access Corporation"'

// assign a sort order

Send DeleteSortOrder of hoReport

Send AppendSortField of hoReport "Cust" "State" crAscendingOrder

Send AppendSortField of hoReport "Cust" "Name" crDescendingOrder

End_Procedure

End_Object


Samples using cdo dynamic data sources

Samples: Using CDO (dynamic data sources)

Object oReport is a cCrystal

Set psReportName To "PercentageFilled.rpt"

Procedure OnInitializeReport Handle hoReport

Handle hoCDO

Integer iItem

Variant[][3] vData

Forward Send OnInitializeReport hoReport

Get CreateCDO of hoReport "Stuff.ttx" to hoCDO

If hoCDO begin

Direct_input "c:MyListOfStuf"

While (not(SeqEof))

Readln vData[iItem][0], vData[iItem][1], vData[iItem][2]

Increment iItem

End

// Add rows to CDO object

Send ComAddRows of hoCDO vData

End

End_Procedure // OnInitializeReport 

End_Object // oReport


Samples using cdo with code validation tables

Samples: Using CDO with Code Validation Tables

Object oReport is a cCrystal

Set psReportName To "PercentageFilled.rpt"

Procedure OnInitializeReport Handle hoReport

Handle hoCDO

Variant[][2] vData

Forward Send OnInitializeReport hoReport

Get CreateCDO of hoReport "States.ttx" to hoCDO

Get TableData of Customer_State_VT to vData

Send ComAddRows of hoCDO vData

End_Procedure // OnInitializeReport

End_Object // oReport


  • Login