Announcement

Collapse
No announcement yet.

Help with Quicksort, sorting array by sub member

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help with Quicksort, sorting array by sub member

    Hi Folks,
    I have an array with two members:
    l.dataset[x]:level
    l.dataset[x]:score

    I am trying to implement the Quicksort function posted here:
    http://www.mivascript.com/topic/sort...hms.html#quick

    I do not quite understand how to call the function,as I am not exactly sure of the require syntax for the parameters.
    I have tried a number of iterations including:
    <MvEval EXPR="{ QuickSortArray( l.dataset, ':score', ascending ) }">
    <MvEval EXPR="{ QuickSortArray( l.dataset, :score, ascending ) }">
    <MvEval EXPR="{ QuickSortArray( l.dataset, ':score', left ) }">
    and various permutations of the above, no luck...all returned results are null.

    Any ideas what I am doing wrong?



    Also..I noticed that in the very first line of the function it reads:
    <MvFUNCTION NAME = "QuickSortArray" PARAMETERS = "array var, subelement, direction" STANDARDOUTPUTLEVEL = "">

    However, later in that function there in no reference to 'array var' but only l.array
    I have tried changing 'array var' to 'l.array' but again..without knowing the proper format/syntax of the parameters I have no idea if this is an issue or not.

    Thanks in advance.
    BTW..I am running miva4.x uncompiled..GASP!
    -Rob

    #2
    Re: Help with Quicksort, sorting array by sub member

    Hey, try throwing the third parameter in single quotes, too.

    Code:
    <MvEval EXPR="{ QuickSortArray( l.dataset, ':score', 'left' ) }">
    PCINET, LLC

    Miva Merchant Design, Development, Integration & Support
    We built the most Miva Merchant stores!
    Miva shopping cart design & integration service and our Portfolio!

    e-mail: [email protected]
    web: www.pcinet.com

    "We who cut mere stones must always be envisioning cathedrals."
    Quarry Worker's Creed

    Comment

    Working...
    X