Query answers of a survey question with text answer type (surveyresultanalytic view)

I am creating a custom report selecting data from surveyresultanalytic view with a SQL query.

My survey contains a question with "Text" answer type. I can find answers for my questions in Q1, Q2, Q3... fields of surveyresultanalytic view except the question of type "Text".

  • Suggested Answer

    0  

    Hi Zsoltv

    "questions" is an array type of field in survey table.

    I don't think you can select data from survey table directly.

    Here is an example for javascript used to get data into other variables:

    ScriptLibrary: SurveyTemplateService

    var questions = record.questions;

    var lng = questions.length();
    for (var i = 0; i < lng; i++) {
    var configItem = questionConfigStore[questions[i]];

    if(configItem){
    (vars.$surveyFieldNames).push(configItem[FIELD_NAMES.DEST_FIELD_NAME]);
    (vars.$surveyQuestionLabels).push(_convertFieldLabelCap(configItem[FIELD_NAMES.QUESTION_LABEL]));
    (vars.$surveyFieldTypes).push(configItem[FIELD_NAMES.DEST_FIELD_TYPE]);
    (vars.$surveyQuestionIds).push(configItem[FIELD_NAMES.ID]);
    (vars.$surveyAnswerTypes).push(configItem[FIELD_NAMES.ANSWER_TYPE]);
    (vars.$surveyGlobalLists).push(configItem[FIELD_NAMES.GLOBALLIST]);
    (vars.$surveyAllowCustomAnswers).push(configItem[FIELD_NAMES.CUSTOM_ANSWER_ALLOWED]);
    (vars.$surveyMandatories).push(configItem[FIELD_NAMES.MANDATORY_CONDITION]);
    //(vars.$surveyFieldOrders).push(configItem[FIELD_NAMES.ORDER]);
    }
    }

    Thanks