Dynamic Data

Dynamic Data

rcwebadminrcwebadmin Posts: 8Questions: 4Answers: 0
edited April 2016 in Editor

I have a SQL Table that I want to connect the editor too, my table however is dynamic, meaning that within my columns (one for course type and course number) there are several metrics within each type and the quantity of metrics vary from course to course. How can I load the editor table so that it loads the correct number of metrics, sort of like a pivot,

My SQL Table is like this:

Name John Sallie Sue
Course Number 120 150 300
Course Type B B A
Category R R/W W
Metric Reading Math Science
Metric Value 2.0 1.5 3.0

But I want to make it appear like this (pivot)

                         Reading                  Math             Science

John 2.0 0.0 0.0
Sallie 0.0 1.5 0.0
Sue 0.0 0.0 3.0

Does that make sense? Basically I want to change this so it does like a for each loop to figure out how many columns a class has then loads it.

columns: [
                {
                    data: null,
                    defaultContent: '',
                    className: 'select-checkbox',
                    orderable: false
                },
                { data: "fkey_instructor1_rcid", visible: false },
                { data: "first_name" },
                { data: "last_name" },
                { data: "fkey_course_id" },
                { data: "course_code"  },
                { data: "course_number" },
                { data: "course_section" },
          { data: "fkey_semester_id"},
          { data: "category"},
          { data: "Metric_text"},
          { data: "response_value"}

            ],
This discussion has been closed.