The code you have posted works as designed.
When using a TRtcDataSet, the "EOF" property returns TRUE after you move *beyond* the Last row and NOT when you are located at the Last row. The same way, the "BOF" property returns TRUE after you move *before* the First row and NOT when you are located at the First row.
Would "EOF" return TRUE when you are located on the last row (which is what happens when you call "Last"), then "EOF" would also need to return TRUE after using "First" with a dataset which only has one row, so the loop using "First", "while not EOF" and "Next" would never show the last row.
Btw ... Using "FieldByName" requires more memory and is slower than using the "as..." property directly. Also, the "asString" property accesses the field using the "AnsiString" type. If you are working with text fields, you should use the "asText" property instead, which accesses the field using the "String" type (Unicode String in D2009 and later).
For example, the code below would work faster, use less memory and also display Unicode strings correctly:
if Data.asFunction.FunctionName = 'select' then
begin
if Result.isType = rtc_DataSet then
begin
Result.asDataSet.First;
while not Result.asDataSet.eof do
begin
Memo1.Lines.Add(Result.asDataSet.asText['Common_Name']);
Result.asDataSet.Next;
end;
end;
end;
There are also other ways to enumerate through a TRtcDataSet. For example, if you wanted to show a specific number of rows, you could use a "for" loop with the "RowCount" property. You can also use the "Row" property to check the current position or move to a new position inside a TRtcDataSet. For more information about working with RTC remote functions and using RTC Value objects, please check the
"Quick Start" section inside this Forum.
PS. Should you have more question about the RTC SDK and the question hasn't already been answered, please start a new Topic in the "PRO Support" section, using a subject line which summarizes the question/problem.
Best Regards,
Danijel Tkalcec