RE: TZF - SetRelationTo question

Lloyd Edwards <[email protected]>
Newsgroups gmane.comp.lang.delphi.topaz
Message-ID <[email protected]>
Dear William, 
    Thanks for the good help. It appears that my way of learning 
something new is to make every mistake possible at least once :). You 
and the others on this list have been lifesavers. 
    Lloyd
William T. Marchant wrote:
> 
> Lloyd,
> 	When setting a relation, I try to follow these guide lines.
> 1.  Both files should have the same size of field which is being used 
> for the 
> comparison.
> 2.  Both fields should be indexed.  
> 3.  If you are using a Date field, it is tricky to get it right. You 
> have to 
> convert Dates to Strings.
> 
> Try something like the following:
> procedure TForm1.SyncFiles;
> var
>   id : string;
> begin
>   MasterFile.disable controls
>   try
>     id := MasterFile.GetCField ('PNumber');
>     if Trim (id) = '' then exit;
>      { If empty you could put up a message and then exit}
>     SlaveFile.SetOrderToTag ('the index'); // whatever your index is
>     SlaveFile.SetFilterTo ('');
>     if SlaveFile.Find (id) then begin
>       SlaveFile.SetFilterTo ('PNumber=="' +id + '"')
>     end else 
>       { Give yourself a not-found message}
>   finally 
>     MasterFile.enable controls;
> end;
> 
> Bill Marchant
> 
> On May 24, 2003 09:14 pm, you wrote:
> > I'm having trouble establishing a simple relation. I've copied the code
> > in the manual, as follows:
> >
> > procedure TFrmMain2.HELecRelation;
> > var ST : string;
> > begin
> >   tzdbHELec.DisableControls;
> >    try
> >     St := tzdbTempYear.GetCField('HELecKey');
> >     tzdbHELec.SetFilterTo('DAYKEY=="' + St + '"');
> >     tzdbHELec.GoTop;
> >   finally
> >     tzdbHELec.EnableControls;
> >   end;
> > end;
> >
> > AND in FormCreate:
> >
> >  tzdbHELec.SetRelationTo(HELecRelation);
> >
> > THe program compiles ok. When I run the program, I get a stack overflow
> > error in the
> > HELecRelation procedure. When I step through it cycles between "begin"
> > and "SetFilterTo" statements in HELecRelation. I've tried every
> > alternative I can think of. Any ideas?
> > Thanks -- Lloyd Edwards
> >
> 

==^================================================================
This email was sent to: [email protected]

EASY UNSUBSCRIBE click here: http://topica.com/u/?clvXPN.a5kvff.Z2NsZHQt
Or send an email to: [email protected]

TOPICA - Start your own email discussion group. FREE!
http://www.topica.com/partner/tag02/create/index2.html
==^================================================================
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.