lib/library.js
function(tdId) {
            let result = query('select * from questionnaire where td_id=?', [tdId]);
            if(result.length > 0) {
                let questionnaire = result[0];
                questionnaire.language_data = {};

                // load data fields
                let dataResults = query('select field, question_td_id from questionnaire_data_field where questionnaire_id=?',
                    [questionnaire.id]);
                for(let data of dataResults) {
                    questionnaire.language_data[data.field] = data.question_td_id;
                }
                return questionnaire;
            }
            return null;
        }
function(tdId) {
            let result = query('select * from questionnaire where td_id=?', [tdId]);
            if(result.length > 0) {
                let questionnaire = result[0];
                questionnaire.language_data = {};

                // load data fields
                let dataResults = query('select field, question_td_id from questionnaire_data_field where questionnaire_id=?',
                    [questionnaire.id]);
                for(let data of dataResults) {
                    questionnaire.language_data[data.field] = data.question_td_id;
                }
                return questionnaire;
            }
            return null;
        }
function ( tdId ) { let result = query ( 'select * from questionnaire where td_id=?' , [ tdId ] ) ; if ( result . length > 0 ) { let questionnaire = result [ 0 ] ; questionnaire . language_data = { } ; // load data fields let dataResults = query ( 'select field, question_td_id from questionnaire_data_field where questionnaire_id=?' , [ questionnaire . id ] ) ; for ( let data of dataResults ) { questionnaire . language_data [ data . field ] = data . question_td_id ; } return questionnaire ; } return null ; }
Returns a single questionnaire
@param tdId {string} the translation database id of the questionnaire
Returns a single questionnaire