Re: Problem with mydata.ex
- Posted by mattlewis (admin) Feb 21, 2010
- 1072 views
davidmosley said...
Hi I have a problem with mydata.ex,When i changed the fields and then i ran the program,i add a record,then i tried to list all records i get a error in the show procedure see below: I can not firure out why,can you help thanks
The error file is telling you what happened. Looking at the relevant pieces:
davidmosley said...
error file:
C:\euphoria\DEMO\mydata.ex:86 in procedure show() subscript value 4 is out of bounds, reading from a sequence of length 3 f = 1 key = {53'5',48'0',53'5',51'3',50'2',53'5',53'5',53'5',56'8',53'5'} data = { {77'M',111'o',115's',108'l',101'e',121'y'}, {68'D',97'a',118'v',105'i',100'd'}, {80'P'} } i = 5
procedure show(file_number f, object key, object data) puts(f, "\n" & key & '\n') -- changed for i = 2 to 1 for i = 2 to length(FIELDS) do puts(f, '\t' & data[i-1] & '\n') end for end procedure
So, the problem is that the sequence data has 3 elements, but you were trying to access the 4th. Somehow, you got a record with too few fields. Did you perhaps run this before where it was saving fewer fields? So it might have loaded in what is now an incomplete record? You might try deleting the mydata.edb file and then start over to make sure that your data is homogeneous.
Matt