Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Calc fields doing something REALLY weird
Sun, Dec 28 2008 6:40 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Anyone

I have the following OnCalcFields event. If I remove {} then at a later stage in the app the code below the OnCalcFields procedure shows a blank _EMail field. If I move the {} to just cover the code inside the then begin..end I also have a blank _EMail. Just using // to comment out the if emAddress_CopyTo.AsInteger > 0 then begin also doesn't work.

lu.MailBox and emAddress are not in any sort of master-detail arrangement - what's going on?????

procedure TEMailIDsForm.emAddressCalcFields(DataSet: TDataSet);
begin
{if emAddress_CopyTo.AsInteger > 0 then begin
 if lu.MailBoxes.FindKey([emAddress_CopyTo.AsInteger])
  then emAddress_xCopyToMailBox.AsString := lu.MailBoxes_BoxName.AsString
 else emAddress_xCopyToMailBox.AsString := '????';
end; }
if emAddress_StoreIn.AsInteger > 0 then begin
 if lu.MailBoxes.FindKey([emAddress_StoreIn.AsInteger])
  then emAddress_xStoreInMailBox.AsString := lu.MailBoxes_BoxName.AsString
 else emAddress_xStoreInMailBox.AsString := '????';
end;
end;


   if emAddress.FindKey([emList.Cells[1, NewRow]]) then begin
   PageControl1.ActivePageIndex := 1;
   showmessage(emAddress.Fieldbyname('_EMail').AsString + ' ... ' + emList.Cells[1, NewRow]);
....
.....

Roy Lambert
Mon, Dec 29 2008 3:45 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< lu.MailBox and emAddress are not in any sort of master-detail
arrangement - what's going on????? >>

I would start with a comprehensive review of all event handlers to make sure
that there isn't some positioning going on that isn't expected.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Dec 30 2008 5:55 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim


I just had a wild and whacky thought and wrapped the offending code in if not emAddress_CopyTo.IsNull then begin...end and it worked. Then I looked at the column definitions and my memory had played me up - the column I wanted was _CopyMailBox not _CopyTo. _CopyMailBox is integer and _CopyTo is VARCHAR.

Its basically my fault for using the wrong column, but its a weird way for it to fail.

Roy Lambert
Image