none
How to group and dense or ties rank with reference to a column RRS feed

  • Question

  • Hello, These codes only gives me ties ranks for only first and last total, can someone help me create a rank with ties using these codes.  see attached picture for what i want to achieve
    Dim TotaledRecords = From p In db.Assessments
                                 Where p.Term = cboterm.Text And p.Year = cboyear.Text
                                 Select p Order By p.Subject, p.Total Descending
            Dim previousSubject As String = ""
            Dim previousTotal As Integer = 0
            Dim position As Integer = 0
    
            For j = 1 To TotaledRecords.Count
                If TotaledRecords.ToList(j - 1).Subject <> previousSubject Then
                    previousSubject = TotaledRecords.ToList(j - 1).Subject
                    previousTotal = TotaledRecords.ToList(j - 1).Total
                    position = 1
                Else
                    If previousTotal <> TotaledRecords.ToList(j - 1).Total Then
                        position += 1
    
                    End If
                End If
                TotaledRecords.ToList(j - 1).Position = position

    Tuesday, November 28, 2017 10:46 PM

All replies

  • Hello, These codes only gives me ties ranks for only first and last total, can someone help me create a rank with ties using these codes.  see attached picture for what i want to achieve

    Hi richabbam,

    According to your description, I am not sure what do you want to do, and I don't see the picture you attached. If you can not attach picture, please give one example to show what you want to do.

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, November 29, 2017 8:36 AM
    Moderator