Enhanced Sort Macro

Product Compare Forums Multi-Edit User Created Macros Enhanced Sort Macro

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
  • #1418
    Bret Sutton

    :D Did you ever want to do a Multi-Edit sort on more than one field, in mixed ascending/descending order?

    :D Did you ever want to sort by date, where the date was in a funky format?

    :D Did you ever want to eliminate duplicate records when you sorted? Or do summary sorts?

    Have I got a deal for you!

    The attached file contains NWSSORT.S the macro and NWSSORT.PDF the documentation. The .S file contains NWS_SortMenu and NWS_TextSort, which are direct replacements for the standard Multi-Edit SortMenu and TextSort macros.

    For the newbies, installation instructions:
    [list:ueo48c3g]> Download, unzip, and save to a good place: C:\MEW\SRC\NWS or some such.
    > Read the documentation. Most of it, anyway.
    > Open NWSSORT.S in Multi-Edit. Compile it: Tools|Execute compiler|Compile CMacWin macro.
    > Change your Text|Sort menu entry to run NWSSort^NWS_SortMenu rather than SortMenu: Tools|Customize|Keys/Commands, do a Search for ‘SortMenu’, and make the appropriate changes.
    > Or you can try it out before changing your keymap by doing Macro|Run and entering NWSSort^NWS_SortMenu.[/list:u:ueo48c3g]


    … Wow. Just … wow. That is increadable. Thank you!


    Ken Walker

    Hey, now this is what ME is all about!!! Way to go Bret!


    Very nice – I especially liked seeing my name listed as an example in the documentation. ;)

    To see my name listed with Todd and Dan makes me feel famous!


    I have a question, using MEW 9.1 I seem to not get the “Sort Marked Block Only” switch, (with this macro, not with the normal sort) even when I mark a block.

    While I tweaked the file to let me do block editing, now I get the error of
    NWSBLOCK.MAC not found.

    This seems to be linked to

    Bret Sutton

    Oops! Part of the problem is that the sort macro makes use of several other of the NWS collection of macros. I haven’t posted the entire NWS collection in several years. Sorry about that.

    The attached zip file includes two additional macro files that should take care of all unresolved NWS macro references. You may want to browse them, as they contain a bunch of interesting macros. I won’t discuss them here as that’s off-topic.

    I don’t know why you did not get the “Sort Marked Block Only” switch, but I am very interested in finding out. Could you email me both the sort macro as you corrected it, and your MECONFIG.DB file? (It is in the CONFIG subdirectory of your Multi-Edit program directory.)



    Hi Bret,
    Unfortunately (for me) now that the sort seems to run, it deletes whatever is sent to it (i.e. the whole file or the block).

    The fix (which wasn’t a fix) was just to add
    sort_block = True; //workaround by Shane
    at line 147 in NwsSort.s

    That’s not a fix, it’s just so I could get this running. Sorry I wasn’t clearer about what I did, I just was looking at getting something running.


    I just released my EDX 3.0 package which includes a major overhaul of Bret’s NWS Sort. The package is at [url:luummb1o]http://www.multieditsoftware.com/forums/viewtopic.php?t=489[/url:luummb1o]

    I also added some documentation on using the Sort to the end of file “EDX Documentation.txt” (In file EDX 3.0.ZIP)

    John Martzouco


    I noticed that when the “Number of characters in sort” vlaue is equal to zero, I get the same result as Shane… all my data disappears after the sort.

    If I perform a Column Select, then the “Number…” field has a non-zero entry in it and all is well.


    Bret Sutton

    Well, darn. Now you’ve given me a reason to stay up. I’ll see what I can dig up. I assume you’re using my version of the code, and not David’s?

    Looks like I didn’t properly follow up with Shane, either. Phoo. If I don’t get back to you in the next few days, bug me.

    Bret Sutton

    Unfortunately, John, I am unable to recreate your problem. I could not solve it for Shane, either, even though he sent me his meconfig.db file. It worked correctly for me every time.

    Please send me, directly via email, copies of your meconfig.db, your wcmdmap.db (or whatever command map file you’re using), and the macro source file containing my sort macro. I’ll give it all another try.



    Here’s my overhauled version of Bret’s NWS sort. The main routine to call is edx$NWS_SortMenu


    The new sort works great for me.

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.