Board index » delphi » D4: Quick Report and memo/blob fields

D4: Quick Report and memo/blob fields

Howdy!

I was wondering if someone could give me a tip on how to get the
Quickreport TQRDBText object  to display a memo or BLOB field.

In the documentation, it states that this object will display everything
w/o caring what the field type is behind it.  I am having a bear of a
time getting it to display a BLOB.  I wish they had the QuickReport 1.1
for D4 out (didn't it have a TQRDBMemo?)

I've tried both hitting a BLOB on an Interbase database (using a BDE
alias) as well as a Memo field in a MS Access database (through ODBC)
and haven't had any luck.

Any pointers?  We recently converted from QR1.0e, and everything came
over (with a little work) except for these fields.

Thanks for any help you can provide.

Hunter

 

Re:D4: Quick Report and memo/blob fields


QR1.0e didn't have a separate memo component. You use a TQRDBText but you
have to set AutoStretch to True. If that doesn't work, try what I have
described below.

I was having trouble with BLOB memos printing in 1.0e. I got an error
message after printing a large number of memos. I finally just handled the
memos myself. I sent them to a data file. I am using Apollo so I used
Apollo.BlobToFile-I'm not sure how to do it otherwise. I used the following
procedure to parse the text and send it to a file.

procedure TfmRCSumry.ParseMsg;
procedure PostMessage;
const MaxWidth = 700;
var F : TextFile;
    TestS, S, w : String;
    ch : char;
    LineNum : Integer;
begin
  tblTempMsg.Open;
  tblTempMsg.Append;
  inc(LineNum);
  tblTempMsg.FieldByName('LineNum').AsInteger := LineNum;
  tblTempMsg.FieldByName('Line').AsString := S;
  tblTempMsg.Post;
end;
begin
  LineNum := 0;
  AssignFile(F, temppath + 'msg.txt');
  Reset(F);
  TestS := '';
  S := '';
  While not eof(F) do begin
    {Read word}
    w := '';
    ch := #0;
    while not eof(F) and not eoln(F) and (ch <> ' ') do begin
      read(F, ch);
      w := w + ch;
    end;
    TestS := S + w;
    qrlAllTxt.Caption := TestS;
    if (qrlAllTxt.Width > MaxWidth) then begin
      PostMessage;
      S := w;
    end
    else if eoln(F) then begin
      S := TestS;
      PostMessage;
      S := '';
      Readln(F);
    end
    else if eof(F) then begin
      S := TestS;
      PostMessage;
      S := '';
    end
    else S := TestS;
  end;
  {Put space between messages}
  S := '';
  PostMessage;
  CloseFile(F);
  tblMsg.Close;
end;

Once I had the memo in the temporary file as a series of lines, I created a
subdetail band with a datalink and printed it that way. It seems rather
convoluted but it worked. In fact in my case it ended up being faster than
using the TQRDBText component for a memo.

Hope this helps,

Anne

Quote
Hunter Trumbo wrote:
> Howdy!

> I was wondering if someone could give me a tip on how to get the
> Quickreport TQRDBText object  to display a memo or BLOB field.

> In the documentation, it states that this object will display everything
> w/o caring what the field type is behind it.  I am having a bear of a
> time getting it to display a BLOB.  I wish they had the QuickReport 1.1
> for D4 out (didn't it have a TQRDBMemo?)

> I've tried both hitting a BLOB on an Interbase database (using a BDE
> alias) as well as a Memo field in a MS Access database (through ODBC)
> and haven't had any luck.

> Any pointers?  We recently converted from QR1.0e, and everything came
> over (with a little work) except for these fields.

> Thanks for any help you can provide.

> Hunter

Re:D4: Quick Report and memo/blob fields


Thanks for the reponse Anne.  I must be mistaken about the separate Memo
component - it's been 3 years since I had to play with QuickReport.  I thought
I'd gotten away from this particular project.

I've tried setting the AutoStretch to True, but it doesn't seem to be solving
the problem.

All I have is 2 forms, one with a few DBEdits, and a single DBmemo, a
datasource, and a button (set to preview the QuickReport on the second form).
The second form has the Table, and a QuickReport with a single detail band
holding several QRDBText fields.  One of these is pointing to the same field as
the DBMemo, and I have made sure AutoStretch is True.

The strange thing is that the report comes out with all the data from the other
fields appearing (this table has over a thousand records), but the memo field
is empty.

I'm going to try things with the code you have cited (thanks), but if you have
any other ideas I'd appreciate them.  I have about a dozen reports, each with a
few memo fields, and I'd rather do it the easy way.

Again, I appreciate your suggestions and I'll keep you posted.

Hunter

Quote
Anne Sainz wrote:
> QR1.0e didn't have a separate memo component. You use a TQRDBText but you
> have to set AutoStretch to True. If that doesn't work, try what I have
> described below.

> I was having trouble with BLOB memos printing in 1.0e. I got an error
> message after printing a large number of memos. I finally just handled the
> memos myself. I sent them to a data file. I am using Apollo so I used
> Apollo.BlobToFile-I'm not sure how to do it otherwise. I used the following
> procedure to parse the text and send it to a file.

> procedure TfmRCSumry.ParseMsg;
> procedure PostMessage;
> const MaxWidth = 700;
> var F : TextFile;
>     TestS, S, w : String;
>     ch : char;
>     LineNum : Integer;
> begin
>   tblTempMsg.Open;
>   tblTempMsg.Append;
>   inc(LineNum);
>   tblTempMsg.FieldByName('LineNum').AsInteger := LineNum;
>   tblTempMsg.FieldByName('Line').AsString := S;
>   tblTempMsg.Post;
> end;
> begin
>   LineNum := 0;
>   AssignFile(F, temppath + 'msg.txt');
>   Reset(F);
>   TestS := '';
>   S := '';
>   While not eof(F) do begin
>     {Read word}
>     w := '';
>     ch := #0;
>     while not eof(F) and not eoln(F) and (ch <> ' ') do begin
>       read(F, ch);
>       w := w + ch;
>     end;
>     TestS := S + w;
>     qrlAllTxt.Caption := TestS;
>     if (qrlAllTxt.Width > MaxWidth) then begin
>       PostMessage;
>       S := w;
>     end
>     else if eoln(F) then begin
>       S := TestS;
>       PostMessage;
>       S := '';
>       Readln(F);
>     end
>     else if eof(F) then begin
>       S := TestS;
>       PostMessage;
>       S := '';
>     end
>     else S := TestS;
>   end;
>   {Put space between messages}
>   S := '';
>   PostMessage;
>   CloseFile(F);
>   tblMsg.Close;
> end;

> Once I had the memo in the temporary file as a series of lines, I created a
> subdetail band with a datalink and printed it that way. It seems rather
> convoluted but it worked. In fact in my case it ended up being faster than
> using the TQRDBText component for a memo.

> Hope this helps,

> Anne

> Hunter Trumbo wrote:

> > Howdy!

> > I was wondering if someone could give me a tip on how to get the
> > Quickreport TQRDBText object  to display a memo or BLOB field.

> > In the documentation, it states that this object will display everything
> > w/o caring what the field type is behind it.  I am having a bear of a
> > time getting it to display a BLOB.  I wish they had the QuickReport 1.1
> > for D4 out (didn't it have a TQRDBMemo?)

> > I've tried both hitting a BLOB on an Interbase database (using a BDE
> > alias) as well as a Memo field in a MS Access database (through ODBC)
> > and haven't had any luck.

> > Any pointers?  We recently converted from QR1.0e, and everything came
> > over (with a little work) except for these fields.

> > Thanks for any help you can provide.

> > Hunter

Re:D4: Quick Report and memo/blob fields


Anne,

I just figured out my problem.  I downloaded the patch from QuSoft (didn't
realize there was one), for the version of QuickReport that shipped with Delphi
4.  It solved my problem (after wasting a couple of days).

I saw your "index out of bounds" question - I remember getting that back when I
was using D1/QR1 - I'll see if I can find the old software testing/resolution
documents to see what we did about that one.  I feel like it had something to
do with master/detail data getting out of whack.  I'll let you know.

Thanks for the help!

Hunter

Other Threads