Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    [VB6] XArraydb.QuickSort

    Buongiorno...VB6
    Ho un problema...
    Dovrei ordinare un XArrayDB attraverso il metodo QuickSort.
    Espongo l'help in linea del metodo:

    QuickSort Method

    Syntax
    XArrayDB.QuickSort rowstart, rowend, column1, order1, type1 [, …, column10, order10, type10]

    Arguments
    * rowstart is a long integer specifying the first row to be sorted.
    * rowend is a long integer specifying the last row to be sorted.
    * column1 through column10 are long integers specifying the indexes of the columns to be sorted, in the order in which they are applied.
    * order1 through order10 are XORDER constants specifying the sort order of the columns.
    * type1 through type10 are XTYPE constants specifying the data type used to coerce column values during comparison.

    Return Value
    None
    Description
    The QuickSort method sorts a range of rows in an XArrayDB object according to the specified column(s). The optional arguments must be specified in groups of three. That is, if you supply a column argument, you must supply its order and type arguments as well. You must provide at least one argument triplet, otherwise a trappable error will occur.

    Example

    The following example initializes a single-column XArrayDB object containing date values in a variety of formats, then uses the QuickSort method to reorder the array in ascending order:

    MyArray.ReDim 1, 4, 1, 1
    MyArray(1, 1) = DateSerial(1998, 2, 11) ' date
    MyArray(2, 1) = "January 22, 1998" ' string
    MyArray(3, 1) = #10/4/1998# ' date literal
    MyArray(4, 1) = CLng(#1/27/1998#) ' long integer

    ' sort all rows of the array
    MyArray.QuickSort 1, 4, 1, XORDER_ASCEND, XTYPE_DATE

    ' print the results
    Debug.Print MyArray(1, 1) ' prints January 22, 1998
    Debug.Print MyArray(2, 1) ' prints 35822
    Debug.Print MyArray(3, 1) ' prints 2/11/98
    Debug.Print MyArray(4, 1) ' prints 10/4/98


    Non ho trovato soluzioni nel caso in cui voglio un ordinamento su 2 colonne dell'XArrayDB.
    Ho provato attraverso un Array, ma mi da sempre errore di argomento non valido.
    Mi sono creato una variabile di tipo variant ed ho inserito al sui interno i vari argomenti, ma nulla da fare.

    Su Internet la ricerca non ha fruttato nulla.

    Qualcuno ha la più pallida idea di quale sia la sintassi giusta da attribuire all'argomento??? :master:

    Grazie a presto

  2. #2
    Soluzione trovata.
    Più semplice di quel che pensassi....

    xArrayTmp.QuickSort 0, xArrayTmp.UpperBound(1), 0, XORDER_ASCEND, XTYPE_INTEGER, 1, XORDER_ASCEND, XTYPE_INTEGER, 2, XORDER_ASCEND, XTYPE_INTEGER

    Ci si perde in un bicchier d'acqua... grazie

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.