sort an array

Bill Randall wrandall at fptech.com
Tue Jun 5 08:50:47 PDT 2018


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
>



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.celestial.com/pipermail/filepro-list/attachments/20180605/4e4a82fc/attachment.html>


More information about the Filepro-list mailing list