Icon View Thread

The following is the text of the current message along with any replies.
Messages 11 to 16 of 16 total
Thread Creating calculated fields at run time.
Tue, Jul 31 2007 8:53 PMPermanent Link

Sean McCall
Jeff,

Override the BLOB field's OnGetText event to have it display real text
instead of the '[memo]'. Simple and doesn't need another grid. You can
also truncate the displayed values if you want.

Sean

Jeff Cook wrote:
> Hi  (DBISAM 3.30)
>
> I have a program that is like a poor man's DBSYS ... select a table
> from the data directory and display it in a grid, select another table
> etc.  We distribute it with our app so that we can do stuff with Remote
> Assistant without putting a "dangerous" utility like DBSYS out in
> public.
>
> What I want to do is have way of displaying the contents of Blobs -
> usually memos really - in the grid without having to double click the
> [BLOB] as at present.
>
> My idea was to create a calculated field for each blob field and and
> populate it with .AsString" in the oncalculate event.
>
> I've run into three problems.
>
> 1.  Even though I think I have created fields for the blobs, I don't
> know how to set the FieldKind to calculated.
> 2.  My created fields don't appear in the grid.
> 3.  When I change my DBISAMTable component to point at a different
> table, I get an error message "DBISAMTable1: Field 'xxxx' not found"
> where xxxx is a field in the previous table.  This is despite having
> the   DBISAMTable1.FieldDefs.Clear;
>
> My code is below.  Am I on the right track?  Despite having a fairly
> low customer number, I've not done much with these
> DBISAMTable1.FieldDefs and I could be going down a completely wrong
> track.
>
> Cheers
>
> Jeff
>
>
> ======================
> procedure TfrmDBISAMFileView.DBISAMTable1BeforeOpen(DataSet: TDataSet);
> var
>   i: integer;
>   b: boolean;
> begin
>   .
>   .
>   .
>   DBISAMTable1.FieldDefs.Clear;
>   DBISAMTable1.FieldDefs.Update;
>   b := False;
>   for i := 0 to DBISAMTable1.FieldDefs.Count - 1 do
>   begin
>     DBISAMTable1.FieldDefs[i].CreateField(DBISAMTable1);
>     if DBISAMTable1.FieldDefs[i].DataType = ftBlob then b := True;
>   end;
>   if b then
>   begin
>     for i := 0 to DBISAMTable1.FieldDefs.Count - 1 do
>       if DBISAMTable1.FieldDefs[i].DataType = ftBlob then
>       begin
>         DBISAMTable1.FieldDefs.Add(DBISAMTable1.FieldDefs[i].Name +
> '_AsString',
>           ftString, 100);
>       end;
>   end;
>   DBGrid1.Columns.RebuildColumns;  // I've tried this in th AfterOpen
> event to with no success
> end;
>
Tue, Jul 31 2007 8:53 PMPermanent Link

This message was cancelled from within Mozilla.
Tue, Jul 31 2007 9:13 PMPermanent Link

"Jeff Cook"
Thanks Sean

Sean McCall wrote:

> Jeff,
>
> Override the BLOB field's OnGetText event to have it display real
> text instead of the '[memo]'. Simple and doesn't need another grid.
> You can also truncate the displayed values if you want.
>

I've got it going now, but thanks for the suggestion ... which I might
just use in an upcoming enhancement.

Cheers

Jeff
--
Jeff Cook
Aspect Systems Ltd
www.aspect.co.nz
+
Joan and Jeff Cook
The Cooks Oasis
www.cookislandsoasis.com
Wed, Aug 1 2007 3:13 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Jeff


Mike's grid is based on plain old DBGrid so your existing code should all work fine. I've now bought TMS for "prettyness" (and a lot of hard work) but I used a modification of Mike's grid for ages - I removed some stuff, added other bits and it dropped in as a straight replacement. The only alterations I had to make were to take advantage of my new stuff, and where I had a single column add in a blank zero width column to accommodate the auto-column sizing.

Roy Lambert
Wed, Aug 1 2007 2:06 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Sean,

<< Override the BLOB field's OnGetText event to have it display real text
instead of the '[memo]'. Simple and doesn't need another grid. You can also
truncate the displayed values if you want. >>

Yep, this is what we do in the ElevateDB Manager and it works fine.

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, Aug 1 2007 6:11 PMPermanent Link

"Jeff Cook"
Meitaki maata, Roy

I'll follow this up sooner rather than later.

Jeff

Roy Lambert wrote:

> Jeff
>
>
> Mike's grid is based on plain old DBGrid so your existing code should
> all work fine. I've now bought TMS for "prettyness" (and a lot of
> hard work) but I used a modification of Mike's grid for ages - I
> removed some stuff, added other bits and it dropped in as a straight
> replacement. The only alterations I had to make were to take
> advantage of my new stuff, and where I had a single column add in a
> blank zero width column to accommodate the auto-column sizing.
>
> Roy Lambert



--
Jeff Cook
Aspect Systems Ltd
www.aspect.co.nz
+
Joan and Jeff Cook
The Cooks Oasis
www.cookislandsoasis.com
« Previous PagePage 2 of 2
Jump to Page:  1 2
Image