Subject Re: [IBO] How add calculated fields at R/T w/ default fields??
Author Helen Borrie
At 06:06 PM 02-11-01 -0800, you wrote:
>The Fields.Count is getting the correct value. Later when doing a
>FieldByName() the field IS found, but it's Index is -1. InfoPower uses the
>Field.Index to map the field to their grid control. That is one reason I
>need to have the Index set to a valid value.

If this problem is persisting after you've fixed the other bugs, you could add a little function to get the index by a back-door route, e.g.

function FindElusiveIndex(aDataset: TDataset; aFieldName: String): integer;
var
ii: integer;
begin
Result := -99;
ii := 0;
with aDataset do
begin
if Fields[ii].FieldName <> aFieldName then
begin
ii := ii + 1;
Continue;
end
else
begin
Result := ii;
Break;
end;
end;
end;

Then, on return, you can test for both -99 and -1 and, if it's neither, you'll have a good index to pass on to the InfoPower component.

Helen

All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________