Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 10 total
Thread Master detail link not working
Wed, Sep 17 2008 10:47 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate


Table Calls is set up as a detail of the table project:

   MasterFields = '_CallID'
   MasterSource = dsProject
   TableName = 'Calls'

After this

 while (not Project.Eof) and (Project.FieldByName('_CallID').AsInteger <>  LoadToCall) do Project.Next;

Calls is not on the right record -

Roy Lambert
Thu, Sep 18 2008 5:50 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< After this

while (not Project.Eof) and (Project.FieldByName('_CallID').AsInteger <>
LoadToCall) do Project.Next;

Calls is not on the right record -  >>

Could you send me the table in question ? (catalog also, please).

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Sep 18 2008 6:38 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim


> while (not Project.Eof) and (Project.FieldByName('_CallID').AsInteger <>
>LoadToCall) do Project.Next;
>
> Calls is not on the right record - >>
>
>Could you send me the table in question ? (catalog also, please).

Unfortunately no, or at least partly no. Of the two tables one (the master) is in-memory created from lots of other tables. I've solved it for now by getting rid of the master-detail and just doing a .FindKey when the master table is scrolled (actually of an OnChange in a dbedit). It was the move to that approach which led to the question about disablecontrols. Thinking about it the problem is the same one just that I hadn't spotted it before.

Roy Lambert
Thu, Sep 18 2008 7:35 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< Unfortunately no, or at least partly no. Of the two tables one (the
master) is in-memory created from lots of other tables. I've solved it for
now by getting rid of the master-detail and just doing a .FindKey when the
master table is scrolled (actually of an OnChange in a dbedit). It was the
move to that approach which led to the question about disablecontrols.
Thinking about it the problem is the same one just that I hadn't spotted it
before. >>

So you're saying that the problem is that DisableControls is in effect ?

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Sep 18 2008 8:28 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim

>So you're saying that the problem is that DisableControls is in effect ?

Not precisely. I was saying that adding in a table.enablecontrols fixed it <vbg>.

But I've just done a bit of research (miracle notification D2006 help worked!) and stuffed in the following line

if project.ControlsDisabled then showmessage('boing');

and I get boing.

I scanned the entire project for disablecontrols and I've found the culprit - see below my sig.

The behaviour must have changed recently, or its my subclassing EDBTable that's done it, or I've changed the code and only just noticed. Pick which one you like.

Roy Lambert

procedure ZapInMemoryTable(WhichTable: TnlhTable; ZapComponent: boolean = True);
var
Zapper: TEDBQuery;
begin
Zapper := TEDBQuery.Create(nil);
try
 try
  if Assigned(WhichTable) and DoesTableExist(WhichTable) then begin
   WhichTable.DisableControls; <<<<<<<<<<<<<<<<<<<<<
   WhichTable.Close;
   WhichTable.Exclusive := True;
   Zapper.SessionName := WhichTable.SessionName;
   Zapper.DatabaseName := WhichTable.DatabaseName;
   Zapper.SQL.Text := 'DROP TABLE ' + WhichTable.TableName;
   Zapper.ExecSQL;
   Zapper.Close;
   if ZapComponent then FreeAndNil(WhichTable);
  end;
 except
//  MessageDlg('Problem experienced deleteing memory table: ' + #13 + WhichTable.Name + #13 + WhichTable.TableName, mtError, [mbOK], 0);
 end;
finally
 Zapper.Free;
end;
end;




Thu, Sep 18 2008 9:29 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< The behaviour must have changed recently, or its my subclassing EDBTable
that's done it, or I've changed the code and only just noticed. Pick which
one you like. >>

I'm going to have to go with the latter. Smiley

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Sep 18 2008 10:12 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim

><< The behaviour must have changed recently, or its my subclassing EDBTable
>that's done it, or I've changed the code and only just noticed. Pick which
>one you like. >>
>
>I'm going to have to go with the latter. Smiley

So would I but your saying it made me think and check a version of the unit that procedure is in - file dated 14/04/2008 and the code is the same. I think I would have noticed sometime in the last 5 months Smiley

Its also very similar to the version I had for DBISAM which has been used for many years.

Roy Lambert
Thu, Sep 18 2008 10:42 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< So would I but your saying it made me think and check a version of the
unit that procedure is in - file dated 14/04/2008 and the code is the same.
I think I would have noticed sometime in the last 5 months Smiley

Its also very similar to the version I had for DBISAM which has been used
for many years. >>

I don't what to tell you - if removing the DisableControls fixes the
problem, then it is most likely caused by the fact that the DisableControls
is disabling the master-detail link.

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Sep 18 2008 11:27 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim


I'm always happy to fix a bug but I hate it when I don't know why it was there in the first place.

Ah well, that's life.

Roy Lambert
Fri, Sep 19 2008 2:53 AMPermanent Link

"Iztok Lajovic"
Roy,

from Delphi help on 'DisableControls method (TDataSet)':
:::
If the dataset is the master of a master/detail relationship, calling
DisableControls also disables the master/detail relationship. Setting
BlockReadSize instead of calling DisableControls updates the detail datasets
as you scroll through the dataset, but does not update data-aware controls.
:::
HTH
Iztok Lajovic


"Roy Lambert" <roy.lambert@skynet.co.uk> je napisal v sporočilo
news:19AE2204-1443-4D5D-A1DC-3701F390CDD6@news.elevatesoft.com ...
> Tim
>
>
>> while (not Project.Eof) and (Project.FieldByName('_CallID').AsInteger <>
>>LoadToCall) do Project.Next;
>>
>> Calls is not on the right record - >>
>>
>>Could you send me the table in question ? (catalog also, please).
>
> Unfortunately no, or at least partly no. Of the two tables one (the
> master) is in-memory created from lots of other tables. I've solved it for
> now by getting rid of the master-detail and just doing a .FindKey when the
> master table is scrolled (actually of an OnChange in a dbedit). It was the
> move to that approach which led to the question about disablecontrols.
> Thinking about it the problem is the same one just that I hadn't spotted
> it before.
>
> Roy Lambert

Image