DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Sort Functions

Is there a function to sort an array of Strings or an array of numbers within DIAdem?
 
Some of the particulars are I would like to extract a column of data that is returned from an advanced query in the datafinder, then sort that list.
 
I can't seem to find a function that sorts arrays in DIAdem.  Maybe I don't know the german word for it! (HA)
 
Jim West
Summitek Instruments
0 Kudos
Message 1 of 3
(4,348 Views)

Hi Jim

In DIAdem you have the command ChnMultipleSort to sort DIAdem channels. To sort a field you find a lot of scripts in the internet e.g. the bubblesort algorithms. The following script sorts an array. It works good, if the array is not to big.

Function bubblesort(arrSort)
Dim iTemp, j, arrTemp
  For iTemp = 0 to ubound(arrSort)
    For j = iTemp + 1 to ubound(arrSort)
      If UCase(arrSort(iTemp)) > UCase(arrSort(j)) Then
        arrTemp = arrSort(iTemp)
        arrSort(iTemp) = arrSort(j)
        arrSort(j) = arrTemp
      End If
    Next
  Next
  bubblesort = arrSort
End Function

Hope this helps

Winfried

0 Kudos
Message 2 of 3
(4,332 Views)
Thank you for the code.  I guess I could written that...
 
Since I usually develop in LabVIEW, I have become lazy.  I just assume that all 'sorts' of functions are builtin.
 
jim
0 Kudos
Message 3 of 3
(4,321 Views)