DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way I can resort the dataportal alphabetically?

Solved!
Go to solution
So I do a huge list of calculations and creating new channels. I want to be able to resort the list of channels in the group 1 only, alphabetically, at the end of my file. Any ideas on how I could do that?
0 Kudos
Message 1 of 3
(5,626 Views)
Solution
Accepted by topic author Jcheese

Hi Jcheese,

 

I happen to have a short script that does that.  Just pass the index of the Group whose Channels you want to sort.

 

Call ChanSort(1)


Sub ChanSort(GroupIdx)
  Dim i, Swapped, ChNo1, ChNo2
  Do ' Until bubble sort of GroupName() is finished
    Swapped = False
    FOR i = 1 TO GroupChnCount(GroupIdx)-1
      ChNo1 = CNoXGet(GroupIdx, i)
      ChNo2 = CNoXGet(GroupIdx, i+1)
      IF StrComp(UCase(ChnName(ChNo1)), UCase(ChnName(ChNo2))) > 0 THEN
        Call ChnMove(ChNo2, Groupidx, i)
        Swapped = True
      END IF ' Name(i) and Name(i+1) need to be swapped
    NEXT ' i
  Loop Until NOT (Swapped)
End Sub ' ChanSort()

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 3
(5,602 Views)

Thanks - worked perfectly for what I needed.

0 Kudos
Message 3 of 3
(5,597 Views)