sort an array

Richard D. Williams richard at appgrp.net
Tue Jun 5 09:59:27 PDT 2018


I've never tried this technique.  I assume it works with alpha-numeric 
data as well.

I will experiment with this.

Thanks,

Richard


On 6/5/2018 10:50 AM, Bill Randall wrote:
> This is a sample of how I have always sorted arrays in filePro if needed.
>
> @keyc::declare junk(2,.0):
> ::dim dat(10)(2,.0):
> ::dat("1")="6";dat("2")="1";dat("3")="4";dat("4")="8";dat("5")="2":
> ::dat("6")="3";dat("7")="5";dat("8")="10";dat("9")="7";dat("10")="9":
> ::zx(2,.0)="1":
> ::ct(2,.0)="1":
> loop:::
> :dat(zx) gt dat(zx+ct):gosub swap:
> :junk ne "" and ct+zx lt "10":ct=ct+"1" ; goto loop:
> :zx ne "9":zx=zx+"1" ; ct="1" ; goto loop:
> ::x=listbox (dat,"1","10"):
> ::end:
> swap:::
> ::junk=dat(zx+ct);dat(zx+ct)=dat(zx);dat(zx)=junk:
> ::return:
>
>
>
> On 6/5/2018 11:26 AM, Richard D. Williams via Filepro-list wrote:
>> Dave,
>>
>> I don't know of any function in FP that will sort an array.
>>
>> What I do is write the array data out to a temporary file that has an 
>> index built in the correct order,
>> clear the array, reach back into the temporary file, and fill the 
>> array again.
>>
>> You can use the tty as a unique identifier for each instance.
>>
>> Hope this helps,
>>
>> Richard
>>
>>
>> On 6/5/2018 9:28 AM, davidrottkamp via Filepro-list wrote:
>>> Hi
>>>
>>> Is there a way to sort an array made inside filepro
>>>
>>> version
>>>
>>> linux
>>>
>>>
>>
>> _______________________________________________
>> Filepro-list mailing list
>> Filepro-list at lists.celestial.com
>> Subscribe/Unsubscribe/Subscription Changes
>> http://mailman.celestial.com/mailman/listinfo/filepro-list
>>
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient&utm_term=icon> 
> 	Virus-free. www.avast.com 
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient&utm_term=link> 
>
>
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.celestial.com/pipermail/filepro-list/attachments/20180605/57ddd935/attachment.html>


More information about the Filepro-list mailing list