Einzelnen Beitrag anzeigen

Delphi.Narium

Registriert seit: 27. Nov 2017
2.490 Beiträge
 
Delphi 7 Professional
 
#2

AW: kbmMemTable index with negativ Values not working

  Alt 26. Nov 2021, 13:31
Delphi 7, kbmMemTable V5.72.

Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);
var
  i : Integer;
begin
  for i := 100 downto -100 do begin
    tb.Append;
    if i mod 2 = 0 then begin
      tb.Fields[0].AsFloat := i / 42;
    end else begin
      tb.Fields[0].AsFloat := i / 42 * -1;
    end;
    tb.Post;
  end;
  tb.First;
  tb.PersistentFile := 'c:\temp\test_unsorted.kbmt';
  tb.Persistent := true;
  tb.PersistentSaved := false;
  tb.SavePersistent;
  tb.IndexName := 'Float';
  tb.First;
  tb.PersistentFile := 'c:\temp\test_sorted.kbmt';
  tb.Persistent := true;
  tb.PersistentSaved := false;
  tb.SavePersistent;
end;
Delphi-Quellcode:
  object tb: TkbmMemTable
    Active = True
    DesignActivation = True
    AttachedAutoRefresh = True
    AttachMaxCount = 1
    FieldDefs = <
      item
        Name = 'Float'
        DataType = ftFloat
      end>
    IndexDefs = <
      item
        Name = 'Float'
        Fields = 'Float'
      end>
    SortOptions = []
    PersistentBackup = False
    ProgressFlags = [mtpcLoad, mtpcSave, mtpcCopy]
    LoadedCompletely = False
    SavedCompletely = False
    FilterOptions = []
    Version = '5.72'
    LanguageID = 0
    SortID = 0
    SubLanguageID = 1
    LocaleID = 1024
    PersistentFormat = csv
    AllDataFormat = csv
  end
  object csv: TkbmCSVStreamFormat
    CommentChar = #0
    EscapeChar = '%'
    DefaultStringFieldSize = 255
    CSVQuote = '"'
    CSVFieldDelimiter = ','
    CSVRecordDelimiter = ','
    CSVTrueString = 'True'
    CSVFalseString = 'False'
    sfLocalFormat = []
    sfQuoteOnlyStrings = []
    sfNoHeader = []
    Version = '3.10'
    sfData = [sfSaveData, sfLoadData]
    sfCalculated = []
    sfLookup = []
    sfNonVisible = [sfSaveNonVisible, sfLoadNonVisible]
    sfBlobs = [sfSaveBlobs, sfLoadBlobs]
    sfDef = [sfSaveDef, sfLoadDef]
    sfIndexDef = [sfSaveIndexDef, sfLoadIndexDef]
    sfPlaceHolders = []
    sfFiltered = [sfSaveFiltered]
    sfIgnoreRange = [sfSaveIgnoreRange]
    sfIgnoreMasterDetail = [sfSaveIgnoreMasterDetail]
    sfDeltas = []
    sfDontFilterDeltas = []
    sfAppend = []
    sfFieldKind = [sfSaveFieldKind]
    sfFromStart = [sfLoadFromStart]
  end
Unsortiertes Ergebnis siehe Datei test_unseorted.kbmt.txt

Sortiertes Ergebnis siehe Datei test_sorted.kbmt.txt

Scheint korrekt zu funktionieren.


Translation per https://www.deepl.com/translator#de/en/

Unsorted result see file test_unseorted.kbmt.txt

Sorted result see file test_sorted.kbmt.txt

Seems to work correctly.
Angehängte Dateien
Dateityp: txt test_unsorted.kbmt.txt (4,4 KB, 0x aufgerufen)
Dateityp: txt test_sorted.kbmt.txt (4,4 KB, 0x aufgerufen)
  Mit Zitat antworten Zitat