Re: Sort problem
- Posted by Derek Parnell <ddparnell at bigpond.com> Jun 11, 2007
- 594 views
don cole wrote: > > This program and data is too lengthy to post here. > > I will try to cut it down to the important parts. However you have cut too much out. I can't understand what you are saying by the example below. > db[1]={"0888","2485","1476"} > db[2]={"A1071","A3108","A3011"} > db[3]={"D0970","D1078","D2530","D1233"} > > --Really db[1]= > -- db[1][1]=number > -- db[1][2]=title > -- db[1][3]=prod co. > -- db[1][4]=cost > -- etc etc.. By this are you saying that db[1][1] which is "0888" is the number, and db[1][2] which is "2485" is the title, and db[1][3] which is "1476" is the prod co. ??? but you say that db[1][4] is the cost but there is no db[1][4]!? Or are you saying that the first record is really {"0888", "A1071", "D0970"} ... but that can't be right either because there is still no 'cost' field. I just don't get what you are trying to say. But regardless of that, can you give us a sample of the PRESORTED sequence and the sequence after YOU sort it? This should take just three lines of code ... for example: constant presorted = {"A1071", "A3108", "A3011"} ? presorted ? sort(presorted) -- {"A1071", "A3011", "A3108" > --this is all saved and loaded in a binary way using > fn = open(file_name, "wb") > fn = open(file_name, "rb") > > --I don't think ther is any problem in this because I am loading > and reading the > --right files only the sort is messed up > > --the way I read results after sort What is the source code of your sort? > > setText(aETS[x],length(db[x])) --the number of files in the data base > setText(bETS[x],db[x][1][1]) --the first record > setText(cETS[x],db[x][$][1]) --the last record > > num of records first record last record > --- -- ------- ----- ------ ---- ------ > 2514 0888 5105 -- this seems ok now > 2527 A1121 A0985 -- this is wrong > 3164 D1000 D0999 -- this is wrong These values have nothing to do with the example data you just gave us. How can we help if you don't tell us what exactly what you have, what you are getting and what you expected? In short, the example you gave us doesn't make sense to me. -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell