Findkey problem

Home Forums kbmMemTable Findkey problem

Viewing 5 reply threads
  • Author
    Posts
    • #55564
      zoran
      Participant

      Hi Kim

      At design time I populate FieldDefs and IndexDefs. All other settings are default. In code I have:

      mt.IndexFieldNames:= ‘Age’;
      mt.IndexName := ‘ix_Age’;

      mt.FindKey([2]);  //there is a row with Age=2.

      Here I get error: ‘There must be at least one field.’

      This started happening with kbmMemTable 7.91.0.

      All my production programs compiled with the new version show the same error.

      Additionally, I cannot set IndexName at design time. Index name is shown in drop down combobox, but when I select it IndexName field stays empty. I tried that with demo program that comes with kbmMemTable and the same happens – cannot set IndexName at design time.

      I have 5 lines demo that illustrates this.

      D 10.3.3, kbmMemTable 7.91.0, kbmMW 5.14.0 Ent.

      Thank you.

      Zoran

       

       

       

      • This topic was modified 4 years, 9 months ago by zoran.
    • #55566
      zoran
      Participant

      In debugger after

      mt.IndexFieldNames:= ‘Age’;
      mt.IndexName := ‘ix_Age’;

      both fields are still empty (?).

    • #55822
      Johan De Beuckeleer
      Participant

      Hello,

      I have a simular  problem after upgrading kbmMemTable from version 7.85 to 7.92.

      Setting IndexFieldNames does not order the records correct.

      When I use FindKey, the function returns “True”, but record is not positioned on the correct position.

      It is positioned on the first record.

      Setting Indexname (after opening the table)  shows the records in the correct order.

      The First and Last function work fine.

      It seems the behaviour of findkey changed from version 7.85 to 7.92 when the index is set by IndexFieldnames.

      Example:

      m_translations := TkbmMemTable.Create(nil);
      //Add fields
      m_translations.FieldDefs.Add(‘Key’,ftString,1024,True);
      m_translations.FieldDefs.Add(‘SubKey’,ftString,255,True);
      m_translations.FieldDefs.Add(‘LanguageID’,ftInteger);
      m_translations.FieldDefs.Add(‘Text’,ftString,1024);
      //Add Index
      m_translations.IndexDefs.Add(‘PK’,’Key;SubKey;LanguageID’,[ixPrimary]);
      m_translations.IndexFieldNames := ‘Key;SubKey;LanguageID’;

      m_translations.Open;
      m_translations.IndexName := ‘PK’;  // =>> if this line is ommitted, Findkey doesn’t work.

      So changing the index using IndexFieldNames doesn’t seem to work starting from version 7.92.

      It seems we will have to create indexDefs and change the IndexName.

      Greetings

      Johan De Beuckeleer

    • #55831
      Yusuf Zorlu
      Participant

      Same problem here! Kim can you please check this asap because ordering / sorting with

      table.IndexName
      table.IndexFieldnames
      table.SortFields

      is not working any more! Code which has worked before 7.92 has problems now and we have urgent calls because of this here!

    • #55832
      Yusuf Zorlu
      Participant

      If you set .Indexname / .IndexFieldnames / .Sortfields when the table is closed, it will not work.

      Setting these properties right after opening the table works in our case.

    • #55836
      kimbomadsen
      Keymaster

      Hi,

      I have fixed the reported bugs. Fix will be in 7.93 to be released shortly.

      /Kim

Viewing 5 reply threads
  • You must be logged in to reply to this topic.