Choice Modeling - Export Design To Qualtrics

From Q
Jump to: navigation, search

Creates a Qualtrics survey based on a Choice Model Experimental Design output and exports it to Qualtrics. See this blog post for a step-by-step guide to using this feature.

How to Create

  1. Add the object:
    1. In Displayr: Insert > More > Choice Modeling > Export Design To Qualtrics
    2. In Q: Automate > Browse Online Library > Choice Modeling > Export Design To Qualtrics
  2. Fill out the Inputs tab as described in this blog post. You will want to have your Choice Modeling - Experimental Design and Qualtrics API information ready.


Example


Output Example:
The output after successfully exporting a design is shown below.


Input Example:
A Choice Modeling - Experimental Design output:


Options

Choice experimental design output A choice model design output from Choice_Modeling_-_Experimental_Design.

Qualtrics API key Text specifying API key for your Qualtrics account. See Qualtrics documentation for information on how to lookup your API key.

Qualtrics data center ID Text specifying Qualtrics datacenter ID. See Qualtrics documentation for how to determine your datacenter ID.

Qualtrics organization ID Text specifying Qualtrics organization ID. See Qualtrics documentation for how to find your organization ID.

Name to use for questionnaire Text giving the name to use for the Qualtrics survey.

URL for existing QSF file Optional URL providing a QSF file, which will be modified/updated to include the choice questions.

Choice question text Text specifying the question to be asked.

Dual response none If this option is checked, a dual-response none question will be included after each choice question in the questionnaire.

None question text Text specifying the question to ask for the dual-response none question.

Alternative labels A comma-separated string specifying labels to use for choice alternatives (not including none alternatives). Alternatively can just be the prefix to use for the alternatives, in which case they will be replicated to be unique. For example, specifying 'Choice ' for an experiment with three alternatives will create the labels 'Choice 1', 'Choice 2', 'Choice 3'.

None labels A (possibly comma-separated) string specifying the text/html to use for the none alternative labels (appearing the top row of the table).

None text A (possibly comma-separated) string specifying the text/html to use for the none alternatives in the body of the question.

Custom style for alternative labels Optional CSS used to style the alternative labels (i.e. the table column labels).

Custom style for attribute labels Optional CSS used to style the attribute names (i.e. the table row labels).

Custom style for attribute names Optional CSS used to style the alternative levels (i.e. the table's inner cells).

Forced responses If checked, the choice questions must be responded to before the respondent can proceed with the questionnaire.

Don't show constant attributes If checked, attributes that are constant across alternatives for a particular question will be hidden when that question is displayed in the questionnaire.

Progress bar If checked, the questionnaire will have a progress bar at the top.

Outputs

A message stating the export was successful and where the survey can be found in Qualtrics.

Code

form.setHeading('Export Choice Experimental Design To Qualtrics');


form.dropBox({name: "formCMD", label: "Choice experimental design output:", types: ["RItem:ChoiceModelDesign"]});
form.textBox({name: "formQuestionText", label: "Choice question text:", prompt: "Enter the text to display for each choice question", required: true});
form.textBox({name: "formSurveyName", label: "Qualtrics survey name:", prompt: "The name to use for the survey", required: true});
form.textBox({name: "formAPIKey", label: "Qualtrics API key", prompt: "Enter your organization's Qualtrics API Key", required: true});
form.textBox({name: "formDataCenterID", label: "Qualtrics datacenter ID", prompt: "Enter your Qualtrics Data Center ID", required: false});
form.textBox({name: "formOrganizationID", label: "Qualtrics organization ID", prompt: "Enter your Qualtrics Organization ID", required: false});
form.textBox({name: "formQSFTemplateFile", label: "URL for existing QSF file", prompt: "Provide the URL of a QSF to add choice experiment to", required: false});

form.group("Formatting");
form.textBox({name: "formAlternativeLabels", label: "Alternative labels", prompt: "Enter text to display for alternative labels", required: false});
form.textBox({name: "formNoneText", label: "Text for none alternatives", prompt: "Enter text to displayr for none alternatives", required: false});
form.textBox({name: "formNoneLabels", label: "None alternatives labels", prompt: "Enter text to use to label none alternatives", required: false});
form.textBox({name: "formLabelStyle", label: "Custom style for alternative labels", prompt: "Enter any special CSS to use for alternative labels", required: false});
form.textBox({name: "formAttributeStyle", label: "Custom style for attribute names", prompt: "Enter any special CSS to use for attribute names", required: false});
form.textBox({name: "formInnerStyle", label: "Custom style for attribute labels", prompt: "Enter any special CSS to use for the attribute levels", required: false});

form.group("Survey Options");
var drn = form.checkBox({name: "formDualResponseNone", label: "Dual response none", default_value: false});
if (drn.getValue())
    form.textBox({name: "formDualResponseText", label: "None question text", prompt: "Enter text to display for dual response none question", required: false});
form.checkBox({name: "formForceResponse", label: "Force responses", default_value: true});
form.checkBox({name: "formHideConstAttr", label: "Don't show constant attributes", default_value: false});
form.checkBox({name: "formProgressBar", label: "Use progress bar", default_value: true});
library(flipQualtrics)

f <- formals(ExportDesignToQualtrics)
addDefaultText <- function(v, dv){
    if (length(v) && nzchar(v)) 
        v
    else dv
}
    
survey.id <- ExportDesignToQualtrics(
        formCMD,
        api.key = formAPIKey,
        data.center.id = addDefaultText(formDataCenterID, f$data.center.id),
        organization.id = addDefaultText(formOrganizationID, f$organization.id),
        save.dir = NULL,
        survey.name = get0("formSurveyName"),
        qsf.template.file = addDefaultText(formQSFTemplateFile, f$qsf.template.file),
        html.template.file = NULL,
        question.text = addDefaultText(formQuestionText, f$question.text),
        dual.response.none = formDualResponseNone,
        dual.response.text = addDefaultText(get0("formDualResponseText"), f$dual.response.text),
        alternative.labels = addDefaultText(formAlternativeLabels, f$alternative.labels),
        none.labels = addDefaultText(formNoneLabels, f$none.labels),
        none.text = addDefaultText(formNoneText, f$none.text),
        label.style = addDefaultText(formLabelStyle, f$label.style),
        attribute.style = addDefaultText(formAttributeStyle, f$attribute.style),
        inner.style = addDefaultText(formInnerStyle, f$inner.style),
        forced.response = formForceResponse,
        progress.bar = formProgressBar,
        activate = FALSE,
        hide.constant.attributes = formHideConstAttr,
        output.message = TRUE
        )