Null error
begin
rtID := [rt];
MyArr[1] := 'A';
MyArr[2] := 'B';
MyArr[3] := 'C';
memo10.lines.clear;
memo10.lines.add(MyArr[rtID]);
end
I get 'Could not convert variant of type [Null] into type [String]'
This when there is no data!
How I can convert a Null into String?
Thank you
rtID := [rt];
MyArr[1] := 'A';
MyArr[2] := 'B';
MyArr[3] := 'C';
memo10.lines.clear;
memo10.lines.add(MyArr[rtID]);
end
I get 'Could not convert variant of type [Null] into type [String]'
This when there is no data!
How I can convert a Null into String?
Thank you
Comments
the index values you have given MyArr[] when you added data to the array elements have no relation to either rtid or rt the value you are using as an index when trying to retreive the value stored in the array elements.
begin
rtID := [rt];
MyArr[1] := 'A';
MyArr[2] := 'B';
MyArr[3] := 'C';
memo10.lines.clear;
memo10.lines.add(MyArr[rtID]);
end
In other words the only valid data in MyArr lies in elements with an index value of 1 to 3, any other value in rtid will produce the error because the array element index value is non existent.
So it is up to the programmer to supply valid index values when loading data into and retrieving data from the array.
for a good example of how to use the array see the
fr\demo\reports demo project and look at the report titled group totals in header.
regards
if [rt]=nil then
rtID := 0
else
rtID := [rt];
MyArr[0] := '0';
MyArr[1] := 'A';
MyArr[2] := 'B';
MyArr[3] := 'C';
memo10.lines.clear;
memo10.lines.add(MyArr[rtID]);
I get 'Undefined symbol ''NIL'''
?!!!!!!!!!!!!!!!!
again
look at the demo as suggested and you will see the correct way to use an array and its index.
regards