Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread FieldDefs problem
Sun, Jun 29 2008 1:50 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

I'm trying to move the contents of a record in one table to another. I'm using the loop below

  for Cntr := 0 to EMails.FieldDefs.Count - 1 do begin
   fNam := EMails.FieldDefs[Cntr].Name;
   if fNam = '_Status' then showmessage(inttostr(lu.ELN.FieldDefs.IndexOf(fNam)));
   if lu.ELN.FieldDefs.IndexOf(fNam) > -1 then lu.ELN.FieldByName(fNam).Assign(EMails.Fields[Cntr]);
  end;

The showmessage is cos it blows up. IndexOf returns 10. I, as far as practicable, work with persistent fields. Should FieldDefs.IndexOf return the field from the underlying table, or the fielddefs as defined in the IDE? If the former what happens about calculated fields?

Roy Lambert
Mon, Jun 30 2008 12:17 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< The showmessage is cos it blows up. IndexOf returns 10. I, as far as
practicable, work with persistent fields. Should FieldDefs.IndexOf return
the field from the underlying table, or the fielddefs as defined in the IDE?
>>

It depends upon the value of StoreDefs.  If StoreDefs is True, then the
FieldDefs will be saved and re-used between executions of the application,
instead of being re-populated every time from the table itself.

<< If the former what happens about calculated fields?>>

Calculated fields don't use FieldDefs.

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Jun 30 2008 1:49 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim

>It depends upon the value of StoreDefs. If StoreDefs is True, then the
>FieldDefs will be saved and re-used between executions of the application,
>instead of being re-populated every time from the table itself.

OK I'm now officially baffled.

From the D6 OLH (I have no idea if the same thing is in D2006 - I won't live long enough to try and find it)

<<StoreDefs is False by default. It becomes True whenever FieldDefs or IndexDefs is updated or edited manually; to prevent edited (or imported) definitions from being stored, reset StoreDefs to False.>>

It looks like neither DBISAM nor ElevateDB follow this. Right / wrong?

Also can you tell me the relationship between the persistent fields I define in the IDE and FieldDefs? I thought I knew but I'm obviously wrong.

Roy Lambert


Mon, Jun 30 2008 2:39 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< It looks like neither DBISAM nor ElevateDB follow this. Right / wrong? >>

What makes you say this ?  StoreDefs is only set to True if you modify one
of the FieldDefs, just like the manual states.

<< Also can you tell me the relationship between the persistent fields I
define in the IDE and FieldDefs? I thought I knew but I'm obviously wrong.
>>

Persistent fields use the FieldDefs for their initial definition.  After
that, the persistent fields use the FieldDefs to verify that the fields are
set up properly with the correct type, size, etc.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Jul 1 2008 2:29 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim

All this time I've been thinking that using the field editor in the IDE was editing the fielddefs. Now I find it isn't.

Roy Lambert
Image