System Error with multi select and link/lookup table

System Error with multi select and link/lookup table

peterbrownepeterbrowne Posts: 314Questions: 54Answers: 0
edited October 2019 in Editor

I am getting a system error when using multi select and joins with link/lookup table. The error only occurs if I make the select multi

            var editor = new $.fn.dataTable.Editor( {
                ajax: "program_data/learning_event_data.php",
                table: "#learning_event_table",
                template: '#learning_event_form',
                fields: [ {
                    label: "Learning Event:",
                    name: "learning_event.learning_event_name"
                }, {
                    label: "Learning Event Outcomes:",
                    name: "learning_event.learning_event_outcome",
                    type: "ckeditorClassic"
                }, {
                    label: "Presentations:",
                    name: "learning_event_presentation_lookup.presentation_fk",
                    type: "select",
                    placeholder: 'No selection',
                    placeholderDisabled: false,
                    placeholderValue: 0,
                    multiple: true
                }, {
                    label: "Conditions:",
                    name: "learning_event_mcondition_lookup.mcondition_fk",
                    type: "select",
                    placeholder: 'No selection',
                    placeholderDisabled: false,
                    placeholderValue: 0
                }, {
                    label: "Rotation/Discipline/Block Sub-group:",
                    name: "learning_event.rdb_group_fk",
                    type: "select",
                    placeholder: 'No selection',
                    placeholderDisabled: false,
                    placeholderValue: 0
                }, {
                    label: "Rotation/Discipline/Block:",
                    name: "learning_event.rotation_discipline_block_fk",
                    type: "select"
                } ]
            } );

Debug shows:

Notice: Array to string conversion in /var/www/html/curriculum_mapper/datatables/lib/Database/Driver/MysqlQuery.php on line 97 {"data":[{"DT_RowId":"row_63","learning_event":{"learning_event_name":"Aetiology of disease","learning_event_outcome":"

    Define pathology, aetiology and pathogenesis<\/li>
    Understand how knowledge of pathology, pathogenesis and aetiology of disease can be utilised in patient care<\/li>
    Describe ways that disease can be classified<\/li><\/ul>","rdb_group_fk":"0","rotation_discipline_block_fk":"20"},"learning_event_presentation_lookup":{"presentation_fk":"0"},"learning_event_mcondition_lookup":{"mcondition_fk":"0"},"rdb_group":{"rdb_group_name":null},"rotation_discipline_block":{"rotation_discipline_block_name":" Presemester"}}]}

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,644Questions: 1Answers: 10,093 Site admin
    Answer ✓

    Sounds like you are attempting to save an array in a string. Do you want to save it as a delimited string, or are you going to use an Mjoin?

    Allan

  • peterbrownepeterbrowne Posts: 314Questions: 54Answers: 0

    Thanks Allan, sounds like I will need to use Mjoin given the one to many relationships and I am using a link table.

    One question: I gather a multi select will work with Mjoin and allow updating to add more child records to the parent?

This discussion has been closed.