Piped text is not appropriate in my case because the question is inside a Loop & Merge block. The same variable gets reused several times within a survey run. Here is what I ended up doing: ``` var questionChoices = Object.values(qualtricsQuestion.getQuestionInfo().Choices); var variableName = questionChoices.find(x => x.Text === text).VariableName; qualtricsQuestion.setChoiceValueByVariableName(variableName, value); ``` `qualtricsQuestion` is the reference of the question I want to edit with javascript. `text` contains the descriptive text for the target input field inside this question. In the case from my initial screenshot, this would contain "byVariableName". `value` contains the value I want to record in this field.
As a follow up on my own question, querying the content of the `VariableName` field from within the `Qualtrics.SurveyEngine.QuestionInfo` object shows that it contains the choice's number in string format, not the content of the `Text` field. So this function seems to have become useless, as one needs to know the number that was affected to the choice in any case. Unless one writes custom code to fetch the number associated with a given Text field. If anyone has already done this, I would appreciate sharing such code.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.