Karen Wickham - 2010-12-17

Having a problem with this.  Trying to convert legacy code which uses RxMemoryData from Delphi 2005 to Delphi XE.  Have downloaded the latest version of Rx Lib and it doesn't seem to work properly.

My program reads lines of address data from a .txt file and stores them as records using RxMemoryData.  I've debugged through and checked that the data is coming off the file correctly.

However, when I later on try to retrieve the data record by record, I get some weird results.  I get a record containing all nulls in the strings, followed by a record containing the strings from the last set of data on the .txt file (there are about 800 sets of data on the file), followed by a record of nulls, followed by a record containin the last set of data … etc

Not sure how to proceed.  I find this difficult to debug because of the use of pointers etc it's difficult to see what's going on behind the scenes.

Because of the change from AnsiString to Unicode string with Delphi XE, I've ensured that my fields which make up each record are now defined as ftWideString.  The code to add each record to RxMemory Data is as follows :-

RxMemoryData.Append;
            RxMemoryData.FieldByName('CompanyName_Line1').AsWideString       := sTemp1;
            RxMemoryData.FieldByName('CompanyName_Line2').AsWideString       := sTemp2;
            RxMemoryData.FieldByName('CompanyName_Line3').AsWideString       := sTemp3;
            RxMemoryData.Post;

sTemp, sTemp1 etc are defined as String.

The code to retrieve the data is as follows:-

RxMemoryData.First;

(then in a loop until RxMemoryData.EOF)
      sTemp1 := RxMemoryData.FieldByName('CompanyName_Line1').AsWideString;
      sTemp2 := RxMemoryData.FieldByName('CompanyName_Line2').AsWideString;
      sTemp3 := RxMemoryData.FieldByName('CompanyName_Line3').AsWideString;
      RxMemoryData.Next;

Anyone any ideas?