Page 2 of 2
					
				Re: New UserLib command: SortStructuredArrayFS()
				Posted: Thu Oct 06, 2016 4:09 pm
				by netmaestro
				In 2006 I was lucky to code something that compiled at all, so the definitive answer is: I haven't a clue if it's stable or not. When something seemed to work, I stopped coding and moved on to something else.
			 
			
					
				Re: New UserLib command: SortStructuredArrayFS()
				Posted: Thu Oct 06, 2016 5:32 pm
				by Kwai chang caine
				Never mind MASTER, it's really normal  
 
 
Each code you create is perfect  
 
So, the codes is like the programmers, they get older a day 

And sometime it not works after numerous time...
For me, it's a little bit more difficult
When i create a new code..it is already surely very old,  

  because never it works  

Thanks a lot to exist MASTER  

 
			
					
				Re: New UserLib command: SortStructuredArrayFS()
				Posted: Thu Nov 17, 2016 10:37 am
				by tj1010
				I had to sort a structured array once based on a number in a string and ended up just doing a bubble sort on that number because the built in options all do in-order. You can do it with anything just adjusting delay with big data.
Code: Select all
Procedure sort()
  Protected i.l
  Protected indy.l=1
  Protected title$
  Protected desc$
  Protected file$
  For i=0 To ArraySize(items())
    If i>0
      If Val(StringField(items(i)\title$,2," "))<Val(StringField(items(i-1)\title$,2," "))
        ;move up
        title$=items(i-1)\title$ : desc$=items(i-1)\desc$ : file$=items(i-1)\file$
        items(i-1)\title$=items(i)\title$ : items(i-1)\desc$=items(i)\desc$ : items(i-1)\file$=items(i)\file$
        items(i)\title$=title$ : items(i)\desc$=desc$ : items(i)\file$=file$
        file$="" : title$="" : desc$=""
        i=0
      EndIf
    EndIf
    Delay(1)
  Next
EndProcedure