【问题标题】:How to write Javascript for setChoiceValueByRecodeValue for matrix questions in Qualtrics如何为 Qualtrics 中的矩阵问题的 setChoiceValueByRecodeValue 编写 Javascript
【发布时间】:2018-07-20 18:49:54
【问题描述】:

我让 Qualtrics 使用 setChoiceValueByRecode Javascript 从嵌入式数据字段自动填充问题选择。对于单选和多选多项选择题,我已经能够成功地做到这一点,但对于 matrix 问题却无法解决。

这是一个使用 ( recodeValue [subID] value ) 在选择题中有效的示例,没有 subID,因为选择题不需要它:

 Qualtrics.SurveyEngine.addOnload(function()
{
    var answer = "${e://Field/DEMOGRAPHICs_Gender}"; 
    var that = this;  
    switch(answer){
        case "Male":
            that.setChoiceValueByRecodeValue(1, true);
            break;
        case "Female":
            that.setChoiceValueByRecodeValue(2, true);
            break;
        case "Non-binary":
            that.setChoiceValueByRecodeValue(3, true);
            break;
        case "Prefer not to answer":
            that.setChoiceValueByRecodeValue(4, true);
            break;
        default: 
            break; 
    }

});

围绕此的documentation from Qualtrics 表明,对于矩阵,我需要指定一个 [subID] 来告知要引用矩阵的哪一行,但 我无法弄清楚这个 [subID] 是什么或在哪里找到它。

例如对于this question...我尝试使用“Amazon”作为子ID,但没有成功。有任何想法吗?

【问题讨论】:

    标签: javascript qualtrics


    【解决方案1】:

    subID(第二个参数)是答案的重新编码(如果矩阵未转置,则为列)。 id(第一个参数)是选择 id(如果矩阵没有转置,则为行)。所以选择第一行和第一列可能看起来像:

    this.setChoiceValueByRecodeValue(1, 1, true);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-10
      • 1970-01-01
      • 2011-09-16
      相关资源
      最近更新 更多