DCBROWSECOL SORT On an Array

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

DCBROWSECOL SORT On an Array

#1 Post by GeneB »

I am doing a massive Clipper conversion and have converted to dozens of DCBROWSE on arrays. I realize now that to go back and add DCBROWSECOL SORT that I would need to browse a dbf not an array.

Is there a way to use Sort on an array browse? Perhaps use Asort() in the SORT codeblock ?
Can't find an example or any posts on this forum.
Just wondering if it is possible or do I go back in a cave and begin rewriting dozens of Browses.

User avatar
sdenjupol148
Posts: 151
Joined: Thu Jan 28, 2010 10:27 am
Location: NYC

Re: DCBROWSECOL SORT On an Array

#2 Post by sdenjupol148 »

Hey GeneB,

Easy to do.
Just use ASort() within your SORT clause as in:

#DEFINE FIRST_NAME 1
#DEFINE LAST_NAME 2

aNames := { {"Roger", "Donnay"}, {"Gene","B"}, {"Bobby",Drakos"}}

DCBROWSECOL HEADER "Last Name";
ELEMENT LAST_NAME WIDTH 10 ;
TOOLTIP "Person's Last Name" ;
SORT {|| ASort(aNames,,,{|a,b| a[DUE_MEDNUM] < b[DUE_MEDNUM] })}


Bobby

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: DCBROWSECOL SORT On an Array

#3 Post by GeneB »

Thanks, Bobby, that works perfectly.

As a point of information, when I was first trying to use it I left OrdSetFocus() in the block for the first element as shown because that column would sort as in the example but it didn't seem to let other columns sort.

You have saved me many, many hours.
The more I discover new features in Express the more impressed I am. It is an amazing product, and this forum is priceless.

GeneB

Post Reply