Duplicate lines

Duplicate lines

54696d2054696d20 Posts: 75Questions: 18Answers: 0

I have a datatable the has duplicate lines. I need to get the duplicate lines for a student and compare the duplicate lines for the best value in certain columns to create one column for each

Example:
http://live.datatables.net/tobabovo/33/edit

"StudentID":"432009", has 3 lines. I need to add some logic to compare each column and make one column with the best value (or one that a logic decides)

Not sure if this is something that someone has tried before or something that's kind of built in. I can add some logic in place to find the right value.

**note.. All values are a string. Would have to add something to convert the number strings to an int and compare.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Answer ✓

    DataTables doesn't have anything built in to do that I'm afraid. Each row is 100% independent from the other rows, so there is no way to filter based on the content of others rows.

    Given that you are using data I'd suggest doing the search before you pass it into the DataTable. That way you can use just a plain Javascript for loop and keep the best result for each student, comparing to what has gone before.

    Allan

  • 54696d2054696d20 Posts: 75Questions: 18Answers: 0

    @allan I just saw that you answered this. That's what I thought. So I built that logic before passing it to the front end.

This discussion has been closed.