sorting a column values in hierachical spread

Posted by: arunkumar on 8 September 2017, 2:17 pm EST

  • Posted 8 September 2017, 2:17 pm EST

    Hi,


    I have spread with 3 levels of hierachical data. I have header visible only for to of the parent column. i want to sort all the levels of data in one column. based on sorting i want to assign ranks in another column.


    In the screen shot i have marked a column in red colour. In that i want to sort the values in ascending after sorting that column based on sorting i want to assign sequential values in another column.


    Kindly help in this issue.


    Thanks in advance,


     


     


    2010/04/ViewRank.JPG
  • Replied 8 September 2017, 2:17 pm EST

    Hello,

    You may use Spread's AutoSortingColumn Event and set the sort for Child views as per your requirement.Please have a look at the following code that I used to sort the child views along with the parent view.

    Private Sub FpSpread1_AutoSortingColumn(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.AutoSortingColumnEventArgs) Handles FpSpread1.AutoSortingColumn
            Dim csv, csv1 As FarPoint.Win.Spread.SheetView
            csv = FpSpread1.ActiveSheet.GetChildView(0, 0) ' gets the first child veiew for first row.
            csv1 = FpSpread1.ActiveSheet.GetChildView(0, 0).GetChildView(0, 0) ' get the second child view for second row.
            csv.SortRows(1, False, True, System.Collections.Comparer.Default)
            csv1.SortRows(1, False, True, System.Collections.Comparer.Default)
    End Sub

    Later on you may set the values for the corresponding child columns using the code as above.

    Thanks,

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels