  UCRPE: TCrpe Crystal Reports Delphi Component 
Version: 1.05a
 Author: John Murphy All Rights Reserved
    CIS: 72623,2075
  Email: jmurphy@shore.net
  Time : 08:43 PM EDT 7/28/95


PLEASE READ! TCrpe 1.05 has some signifigant changes in data types and enumerated values. See the notes
below.

Added 1.05 	Execute Method
		
		Crpe1.Execute may be used in place of Crpe1.Action := 1


Property Changes in 1.05

	Destination Property:
	
	 	Destination enumerated values have changed from (Window, Printer, FileOut ...)
		to   (toWindow, toPrinter, toFile, ...)
	
		Many people have tried to use the TPrinterDialog to query the user for a Printer
		at run-time. This code snippet shows how you get the selected printer from the
 		TPrinterSetupDialog from the user and pass the information into an instance of TCrpe.
		Note also the use of the Delphi's Printer variable, this is the main reason that
 		the Destination properties have changed.

[snip]
[in the forms implementation section]

implementation

uses Printers;

{$R *.DFM}

{ Push button to get and set the selected printer }
procedure TForm1.btnPrinterClick(Sender: TObject);
var
   lpPrinter, lpDriver, lpPort : PChar;
   hMode                       : THandle;
begin
   try
      lpPrinter := StrAlloc(255);
      lpDriver := StrAlloc(255);
      lpPort := StrAlloc(255);
      PrinterSetupDialog1.Execute;
      Printer.GetPrinter(lpPrinter, lpDriver, lpPort, hMode);
      Crpe1.PrinterName := StrPas(lpPrinter);
      Crpe1.PrinterDriver := StrPas(lpDriver);
      Crpe1.PrinterPort := StrPas(lpPort);
   finally
      StrDispose(lpPrinter);
      StrDispose(lpDriver);
      StrDispose(lpPort);
   end; { Protected Block }
end;


Fixed 1.05

	Cleanup when ECrpeError(ECRPE_REPORT_NOTFOUND) is raised.
	SQLQuery, was not being sent to Engine correctly.
	SetPrintOptions to initialize structSize

Changed 1.05

	

	SelectionFormula and GroupSelectionFormula have changed from type string to type
	TCrpeString. Many users asked for this one, you know can have selection formulars
	much greater in length than the string limit of 255.

        class TCrpeString descends from TStringList


	The following is now legal in 1.05 and greater:

	DESIGN-TIME
		TCrpeStrings get the string list property editor.

	RUN-TIME
		Crpe1.SelectionFormula.Assign(AnotherTCrpeString);

		Crpe1.SelectionFormula.LoadFromFile ( 'FOO.TXT' );

		Crpe1.SelectionFormula[ 0 ] := '{DBFILE.Field}=0';
		Crpe1.SelectionFormula[ 1 ] := ' and {DBFILE.Field2}=1';

		However, the following would raise an exception:

		Crpe1.SelectionFormula[ 0 ] := '{DBFILE.Field}=0';
		Crpe1.SelectionFormula[ 2 ] := ' and {DBFILE.Field2}=1';

Changed 1.05

	MarginProperties Now Default to PE_SM_DEFAULT 32768, this will prevent the margins which are
	defined in the report from being set to 0s. 

	Type FWindowBorderStyle to TFormBorderStyle
	Type FWindowState to TWindowState

-----------------------------------------------------------------------------------------------------------
Fixed 1.04	      DataFiles[] property Subscript Error generated in error.

Added 1.04            Properties:
                         Run-Time:
                          GraphData[n], GraphOptions[n], GraphText[n], GraphType[n]
                      Will document these in the next rev of the help file.


                      Version 1.03 has 51 properties exposed to the Crystal Reports CRPE.DLL
                      print engine. 41 are available from the Object Inspector, 10 run-time.

                      It should also be noted that the following exceptions may be raised:

                         ECrpeError  ( base class, all TCrpe errors descend from ECrpeError)
                         ECrpeEngine ( any error returning from the print engine, note that when
                                       this exception is raised, you can evaluate the run-time
                                       read-only properties of LastErrorNumber and LastErrorString.
                         ECrpeConnect ( error from the connect string parser )
                         ECrpeSubscript ( returned from invalid references to the array properties )

 
             NOTE:    Version 1.03 checks for the version number of CRPE.DLL and will raise
                      an exception when an version other than 4.0 of CRPE.DLL is found.
                      There will be a version 3 compatible component available soon, the 
                      interface and the name will probably be the same so nobody will have
                      to change any code. Any comments on this let me know.

Fixed 1.03            Fixed GPF with DataObjects on same form.
                      Fixed SelectionFormula, GroupSelectionFormula

Added 1.03
                      Help: Refer to pg 78-80 of the Delphi Component Writers Guide for 
                            instructions on linking in the TCrpe help ('ucrpe.hlp'). Please
                            excuse the fact that the help file is rather sparten and it is
                            only up to the functionality of version 1.02 of the TCrpe component.
                            I would also like to thank Curtis White for creating the help file.

                      Destination: Formats Added 
                                   Records, TabSeparated, Ascii, Dif, Csv, CharacterSeparated,
                                   TabSeparatedText, CrystalReportRPT, Excel2, Excel3, Excel4,
                                   LotusWK1, LotusWK3, LotusWKS, RTF, WordForDOS,
                                   WordForWindows, WordPerfect
 
                      NOTE: That the Crystal equivalent to Records is Record and Ascii appears is Text
                            I wanted to change the names due to the fact that Record and Text are key
                            words in Pascal.

                      Properties:  FPrintFileName,
                                   FPrintFileCharSepQuote
                                   PrintFileCharSeparator
                                   EMailCCList            
                                   EMailMessage
                                   EMailSubject
                                   EMailToList
                                   EMailVIMBCCList
                                   FEMailVIMBCCList

                        run-time:
                                   LastErrorNumber
                                   LastErrorString


Added 1.02
   Object Inspector:

       MDIChild           : Boolean

       SQLQuery           : TStringList (multiple lines no line can exceed 255 char, max 32K)

                            The crystal print engine will allow changes in the order by and
                            the where sections of the statement. The select and from                                    sections must be identical to the reports SQL statement.


   Run-time:
       Three new array properties

       SortFields[n]      : array of strings read/write, with SortFields[0] being the                                   outermost.

          format
                '-,+{TABLE.FIELD}' 
          notes
                - Descending + Ascending + Default

       GroupSortFields[n] : array of strings read/write, with GroupSortFields[0] being the
                            outermost.
          format
                '+ Max ({orders.Amount}, {orders.Customer})'

                
       GroupCondition[n]  : array of strings read/write, with GroupCondition[0] being the
                            outermost.
          format 
                'GROUP1;{ERROR TABLE.ERROR CODE};ANYCHANGE;D';

                GROUPn      Group Number 1..n
                Field       Name of the field that triggers a grouping
                Condition   Condition that triggers the grouping (see table)
                Sort Order  (A Ascending, D Descending)

                   Date Fields

                      Daily		DAILY
                      Bi-Weekly		BIWEEKLY
                      Semi-Monthly	SEMIMONTHLY
                      Monthly		MONTHLY
                      Semi-Annually	SEMIANNUALLY
                      Annually		ANNUALLY

		  Boolean Fields

                      To Yes		TOYES
                      To No             TONO
                      Every Yes         EVERYYES
                      Every No          EVERYNO
                      Next Yes          NEXTYES
                      Next No           NEXTNO

                  All other data types
                                        ANYCHANGE

Added 1.01
   Object Inspector:

       Connect : string

       format 
       DSN = name;UID = userID;PWD = password;DSQ = database qualifier

       For Logging on to SQL Server or local paradox tables

       DSN is the server name.
       UID is the user name.
       PWD is the password.
       DSQ is the database name.


   Run-Time:
       UserName : string  for Ms Access Databases only
       Password : string  for Ms Access Databases only



----

This component is still being developed as a Delphi replacement to the Crystal.VBX
custom control I hope to make it functionally equivalent, to date I have 
only tested it with dbase, foxpro, paradox, access tables using Crystal Reports
Version 4.0 reports. The SQL stuff has been tested with ODBC using foxpro tables.
The connect property has been tested with paradox password protected tables.

All the properties are active and you can set most of them at design-time. 

To install the component in Delphi choose: Options, Install Components, Add
then Add the unit uCrpe.dcu. Press OK. You want to ensure that the units that
UCRPE.DCU uses are also in your library path.

The Component will be added to your Data Access page on the Delphi palette.

There are three run-time properties:

	Datafiles[]	Run-time, read, write, not expandable.

	You can use this Property to change the location of the tables at runtime,
        the tables must appear in the same order in which they are defined in the
	report.

	e.g.
        report definition:
                D:\GL\ACCT\TABLE1.DBF
                D:\GL\ACCT\TABLE2.DBF

	Delphi code:
		Crpe1.Datafiles[0] := 'C:\GLAPP\DATA\TABLE1.DBF';
		Crpe1.Datafiles[1] := 'C:\GLAPP\DATA\TABLE1.DBF';

	Formulas[]      Run-time, read, write, not expandable

	You can change your report formulas at run-time with the formula property array.
	The order is not significant, use the formula name.

        e.g.
	report definition:
		BeginDate	Formula Text: Today
		EndDate			       : Today

	Delphi code:
 		Crpe1[0] := 'EndDate="' + sBeginDate + '"';
		Crpe1[1] := 'BeginDate="' + sEndDate + '"';


	Action		Run-time

	Set this to 1 to run the report. Button Click event etc.

	Delphi code:
		Crpe1.Action := 1;


This is an initial build of this component, I needed it for a project that I am working
on, I will update as it matures.

/jbm
