Board index » delphi » crystal reports master detail report.

crystal reports master detail report.

hi all can anyone please help. I am trying to get a report from delphi,
using dbase files & clipper ntx indexes.
what i require is the old select a client and get details of that
clients transactions. Getting the report to select
just the client is ok, however how do i get it to limit the transaction
records by date? The two files are linked,
but i am at my wits end trying to limit the detail lines to a date
range. I have tried to create a sub report but i will
be in my grave before it stops sorting itself out (master 22 records,
details +- 9000 } i realize at a worse case
this can mean evaluating  198000 records but even so that is not all
that many.
the code following is one of the ways i have approached the problem
however i get a formula error in this case.

  cust_sel   := '{fnsdcl01.name} = "'+ cl_name + '" and
{fnsddn02.dl_date} = "' + start_date + '"';

 // cust_sel   := '{fnsdcl01.name} = "'+ cl_name + '";  with just this
selection in works ok but lists all lines.

  dm_2.crpe1.ReportName := sDbf_path + '\delivery_history.rpt';
  dm_2.crpe1.Tables.Retrieve;
  dm_2.crpe1.Tables.Path := sDbf_Path ;
  // dm_2.crpe1.Tables.name := 'fnsdcl01.dbf';

  dm_2.crpe1.SortFields.Retrieve;
  dm_2.crpe1.SortFields.Clear;
  dm_2.Crpe1.Selection.Formula.Clear;
  dm_2.Crpe1.Selection.Formula.add(cust_sel);
  dm_2.Crpe1.Selection.Replace;

I have also tried using a groupe select for the client file (fnsdcl01)
but could not figure out how to limit the detail
file (fnsddn02) to a date range.

p.s. Have also used the ansiquoted string format in the formula lines
with same results.

any help or pointers as to where to look next really appreciated.
thanks in advance Peter MacNaught

 

Re:crystal reports master detail report.


Hi:

  This is a record selection formula. First formula controls what kind
of invoice and second the invoice date. App goes through with a window
and loads invoice date into a field then Crystal uses that date to
select the invoices to print.

  I don't know if this helps but that is how I do this kind of thing.

WhileReadingRecords;
if {@InvoiceKind} = "Renewal" then {mempay2.REMIND_LET} = {@InvoiceDate}
else
if {@InvoiceKind} = "Credit" then {mempay2.CRDREM_LET} = {@InvoiceDate}

Re:crystal reports master detail report.


Quote
"peter" <pak05...@pixie.co.za> wrote...
> just the client is ok, however how do i get it to limit the transaction
> records by date? The two files are linked,
> but i am at my wits end trying to limit the detail lines to a date
> range. I have tried to create a sub report but i will

Date ranges in Crystal can be a real pain.  My advice is to edit the selection
formula in Crystal, using whatever ToText or Date(YYYY/MM/DD) function works so
you can say:

{table.datefield} < Date('2000/01/01') and {table.datefield} > Date('1999/01/01)

Obviously, this isn't real code, but it should make the point.  Once you've got
this format figured out, then create two new formulas, @BegDate and @EndDate.
They should just be '2000/01/01', no complex formulas or anything, just string
values.  Replace the hard-coded values in the selection formula with @BegDate
and @EndDate.  Use the Crystal VCL to override the formula definitions for
@BegDate and @EndDate to be the dates you want.  You may need to play with using
" in your Crystal formulas to make it easier to pass values.

-Brion

P.S. - always avoid subreports.  They look cool but they usually take way too
long to execute.

Other Threads