Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

sorting

BravoknightBravoknight Member Posts: 35
i have some arrays that i want the user to be able to sort by the following...(each option is an array,like all the first names are in one array)
first name (alphabetically)
last name (alphabetically)
rank (Private,PFC, LCPL,CPL,SGT,SSGT,GSGT,FSGT,2nd Lt.,1st Lt.,CAPT,MAJ,Lt. Col., COL)
and le class (1-4)

also when u pick an option, it will move that and all correponding arrays...lemme give u an example....

First Name Last Name Rank LE Class
Mike Joe SGT 2
Jane Doe CAPT 4
Bob Dirls PFC 1

i want that to be in first name alphabetical order,so bob, dirls, PFC and 4 need to all move together. i know it sounds confusing, but thats the best i can explain for right now

Comments

  • detjdetj Member Posts: 16
    : i have some arrays that i want the user to be able to sort by the following...(each option is an array,like all the first names are in one array)
    : first name (alphabetically)
    : last name (alphabetically)
    : rank (Private,PFC, LCPL,CPL,SGT,SSGT,GSGT,FSGT,2nd Lt.,1st Lt.,CAPT,MAJ,Lt. Col., COL)
    : and le class (1-4)
    :
    : also when u pick an option, it will move that and all correponding arrays...lemme give u an example....
    :
    : First Name Last Name Rank LE Class
    : Mike Joe SGT 2
    : Jane Doe CAPT 4
    : Bob Dirls PFC 1
    :
    : i want that to be in first name alphabetical order,so bob, dirls, PFC and 4 need to all move together. i know it sounds confusing, but thats the best i can explain for right now
    :

    I am unable to understand. Its quite confusing. Just tell me whether you want the firstname and the lastname to be sorted, or all the options including rank and class. What do mean by picking an option?

  • KDivad LeahcimKDivad Leahcim Member Posts: 3,948
    : : i have some arrays that i want the user to be able to sort by the following...(each option is an array,like all the first names are in one array)
    : : first name (alphabetically)
    : : last name (alphabetically)
    : : rank (Private,PFC, LCPL,CPL,SGT,SSGT,GSGT,FSGT,2nd Lt.,1st Lt.,CAPT,MAJ,Lt. Col., COL)
    : : and le class (1-4)
    : :
    : : also when u pick an option, it will move that and all correponding arrays...lemme give u an example....
    : :
    : : First Name Last Name Rank LE Class
    : : Mike Joe SGT 2
    : : Jane Doe CAPT 4
    : : Bob Dirls PFC 1
    : :
    : : i want that to be in first name alphabetical order,so bob, dirls, PFC and 4 need to all move together. i know it sounds confusing, but thats the best i can explain for right now
    : :
    :
    : I am unable to understand. Its quite confusing. Just tell me whether you want the firstname and the lastname to be sorted, or all the options including rank and class. What do mean by picking an option?
    :
    :

    It's simple enough, really. He has multiple arrays that all need to be sorted based on the sort order of one array. Here's what I would do:
    [code]
    Type PI
    fName As String
    lName As String
    Rank As String 'Preferably, use a Long with a number related to rank
    leClass As Long
    End Type
    Dim arr() As PI
    [/code]
    That may need some adjustment for QB...

    arr(0).fName = "Mike"
    arr(0).lName = "Joe"
    arr(0).Rank = "SGT"
    arr(0).leClass = 2
    arr(1).fName = "Jane"
    ....
    Repeat for the others.

    Now you only have one array to sort. As for sorting, I'll let someone else work it out.
  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    _________ < http://forcoder.org /> free video tutorials and ebooks about ( JavaScript Swift Visual Basic .NET Scratch Assembly Java C Delphi R Go PL/SQL Visual Basic Ruby Perl C# Python PHP C++ MATLAB Objective-C SAS Bash Logo D Apex Julia Erlang Transact-SQL Dart Rust Scala Alice Prolog Lua Fortran Clojure Ada FoxPro ML Awk Lisp Hack Kotlin COBOL ABAP LabVIEW Scheme Crystal F# VBScript ) _________

Sign In or Register to comment.