Recent

Author Topic: setting Float precision in BufDataSet  (Read 3791 times)

tatamata

  • Hero Member
  • *****
  • Posts: 734
    • ZMSQL - SQL enhanced in-memory database
setting Float precision in BufDataSet
« on: October 22, 2009, 06:44:13 pm »
A piece of code:
Code: [Select]
  //Create and activate BufDataSets

  for I:=Low(vSaveTables) to High(vSaveTables) do begin

    vSaveTables[I].Active:=False;

    //Set precision for Float type

    for J:=0 to vSaveTables[I].FieldDefs.Count-1 do begin

      if vSaveTables[I].FieldDefs[J].DataType=ftFloat

        then begin

          vSaveTables[I].FieldDefs[J].Precision:=SdfDatasetOptions.FieldByName('FloatPrecision').AsInteger;

        end;

    end;

    vSaveTables[I].MaxIndexesCount:=1000;

    vSaveTables[I].CreateDataset;

    vSaveTables[I].Active:=True;

  end;
I hoped I will be able to enable users to define their own float precision, but it seems that number of digits is always variable (default) and that vSaveTables.FieldDefs[J].Precision:=SdfDatasetOptions.FieldByName('FloatPrecision').AsInteger;
 didn't affect it at all?
What is wrong with my code?

tatamata

  • Hero Member
  • *****
  • Posts: 734
    • ZMSQL - SQL enhanced in-memory database
Re: setting Float precision in BufDataSet
« Reply #1 on: October 22, 2009, 10:46:40 pm »
What is correlation between DataSet1.FieldDefs[J].Precision and (DataSet1.Fields[J] as TFloatField).DisplayFormat?

 

TinyPortal © 2005-2018