Re: labels and quickreports

"andre" <[email protected]> Mon, 03 Mar 2003 23:33:11 -0800 (PST)
Newsgroups gmane.comp.lang.delphi.quick-reports
Message-ID <20030303233311.9591.h000.c015.wm@mail.mensand.com.criticalpath.net>
On Mon, 03 Mar 2003 23:24:21 -0800 (PST), Martin wrote:
Hi,

I think you need to expand your OnNeed a bit.

    inc(giIndex); // Always !!
    if giIndex = giStartLabel then // First label to print
      qryDetail.First
    else if giIndex > giStartLabel then // Next label to print
      qryDetail.Next;
  
    QRDBText1.Enabled := (giIndex >= giStartLabel); // Enable only when we want to print
    QRDBText2.Enabled := (giIndex >= giStartLabel); // same
    QRDBText3.Enabled := (giIndex >= giStartLabel); // same

    MoreData := (not qryDetail.EOF); // is there more data in the dataset ?

Greetings Andre Mens (Author of QReport Artist)

[email protected]
www.mensand.com    Home of QuickReport Artist The enduser editor for all your QuickReports

[email protected]  
www.rapware.com  Home of all EASY products 
  like EASY MAPI your Email sollution provider
  and  EASY Script Studio Customizations sollution for your applications with a compleer IDE
  and  EASY SOAP expand your apps with WEB Methods without writing a single line of CODE  


> 
> i have had a look on the companion cd. i have managed to do what i want but 
> with some side effects. because what i am doing is initially disconnecting 
> the dataset before i preview the report. and in my OnNeedData i have this:
> 
>    if giIndex < giStartLabel then
>    begin
>      Inc(giIndex, 1);
>      QRDBText1.Enabled := False;
>      QRDBText2.Enabled := False;
>      QRDBText3.Enabled := False;
>    end
>    else
>    begin
>      if rptLabels.DataSet = nil then rptLabels.DataSet := qryDetails;
>      QRDBText1.Enabled := True;
>      QRDBText2.Enabled := True;
>      QRDBText3.Enabled := True;
>    end;
>    MoreData := True;
> 
> both giIndex and giStartLabel are global variables of integer initialised 
> to 1, but giStartLabel will be changed depending on what is passed into the 
> calling procedure. which looks like this
> 
> procedure PrintLabels(piJobNo: Integer; pbPrint: Boolean; AOwner: TComponent);
> var lsResult: String;
> const
>    csSelect = 'Select * From Details Where JobNo = %d';
> begin
>    giIndex := 1;
>    lsResult := InputBox(Application.Title, 'Enter Start label position', '1');
>    if (Trim(lsResult) <> '') and (StrToIntDef(lsResult, 0) > 0) then
>      giStartLabel := StrToInt(lsResult);
> 
>    frmLabels := TfrmLabels.Create(AOwner);
>    with frmLabels do
>    begin
>      qryDetails.SQL.Text := Format(csSelect, [piJobNo]);
>      qryDetails.Open;
> 
>      // logic to disconnect the query component from the detail until
>      // set number of labels has been met.
>      if giStartLabel > 1 then
>        rptLabels.DataSet := nil;
> 
>      if pbPrint then
>        rptLabels.Print
>      else
>        rptLabels.Preview;
>    end;
>    FreeAndNil(frmLabels);
> end;
> 
> then end result is that it starts at the correct position but it doesnt 
> reconnect the Dataset back up correctly and keeps producing labels until i 
> cancel the report.

------------------------ Yahoo! Groups Sponsor ---------------------~-->
New Yahoo! Mail Plus. More flexibility. More control. More power.
Get POP access, more storage, more filters, and more.
http://us.click.yahoo.com/Hcb0iA/P.iFAA/46VHAA/i7folB/TM
---------------------------------------------------------------------~->

=============================================
QReport Artist 5 - http://www.mensand.com/
The new version is available for Delphi 5.0 ,
Delphi 4.0 and Delphi 3, BC++Builder 3.0. and BC++Builder 4.0 
============================================= 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/