Al parecer el orden de asignacion en delphi 2010 afecta por lo que actualizo la funcion
Código Delphi
[-]CrearCampoCalculado(DataSet :TDataSet; nombrecampo :string; tipo :TFieldType; longi :integer);
var
f: TField;
i: Integer;
begin
try
DataSet.FieldDefs.Update;
for i:=0 to DataSet.FieldDefs.Count - 1 do
if DataSet.FindField(DataSet.FieldDefs[i].Name) = nil then
DataSet.FieldDefs.Items[i].CreateField(DataSet);
if DataSet.FindField(nombrecampo) = nil then begin
case tipo of
ftString: f:=TStringField.Create(DataSet);
ftInteger: f:=TIntegerField.Create(DataSet);
ftFloat: f:=TFloatField.Create(DataSet);
ftBoolean: f:=TBooleanField.Create(DataSet);
else GeneraLog('Tipo de campo no contemplado: ');
end;
if f <> nil then begin
f.Name:=DataSet.Name+nombrecampo;
f.FieldName:=nombrecampo;
f.DisplayLabel:=nombrecampo;
if tipo = ftString then
f.Size:=longi;
f.Calculated:=true;
f.FieldKind := fkCalculated;
f.DataSet:=DataSet;
end;
end;
except on e:exception do
GeneraLog(e.Message);
end;