• 0

creating a rank with ties


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. 
 

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

 

onlin.png

Link to comment
https://www.neowin.net/forum/topic/1349524-creating-a-rank-with-ties/
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Thread Locked. 

 

Please note that Neowin will not do your homework/assignment for you. Members are more than  happy to help if there's something that you've started and need some pointers with. See below!

 

  Quote

#1 WE WILL NOT DO YOUR HOMEWORK FOR YOU.
See below...

#2 WE WILL NOT DO YOUR HOMEWORK FOR YOU.
While I don't think anyone here will refuse to help a struggling student, a certain amount of offence is taken when you try to take advantage of our help to get your homework done without putting in any effort yourself. If you copy and paste an assignment without evidence that you've attempted it yourself, you're likely to get hostile responses (see here).
 
 #2a Show Your Work
If you're struggling with an assignment, show us what you've done so far (or at least the relevant portion). If we can see what you've done, we're going to be able to help you more easily!

Expand  

Asking for help with your assignments...

  • Like 1
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.