Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

LimesurveyRC: Can't retrieve answer options for dual-scale questions

  • datamunger
  • datamunger's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 5 months ago - 4 years 5 months ago #190795 by datamunger
When using Python API to retrieve answer options for dual-scale questions, I get "No available answer options".

My query looks like this (works for other question types):
Code:
method = "get_question_properties"
api.query(method=method, params=OrderedDict([
                        ("sSessionKey", api.session_key),
                        ("iQuestionID", '12345')
                    ]))
Last edit: 4 years 5 months ago by datamunger.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 5 months ago #190797 by holch
Not an expert on the Remote Control, but as the dual scale question is actually two questions, you probably need to address each scale separately, not sure how you access them, but probably the Question ID is not enough. Have a look in the Question Logic File, you might get some hints there on how to address the first "question" of the dual scale and how the second "question".

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • datamunger
  • datamunger's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 5 months ago #190798 by datamunger
Thanks for the hint - the scaleID field always returns 0, for every question in the survey, so I can't use this either.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 5 months ago #190799 by holch
manual.limesurvey.org/Expression_Manager...tion_with_two_scales

This is for the expression manager, but I assume something like this will be necessary also for the RC.

The dual scale question type has 3 dimensions:
1. Subquestions
2. Answer options
3. Scale (0 or 1)

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • datamunger
  • datamunger's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 5 months ago #190802 by datamunger
You are correct about the subquestion dimension, this is specified via the iQuestionID. The answeroptions, however, should be returned by the query. There is no way to specify a scaleID with the query as far as I know, but I'd love to learn more. The documentation doesn't specify the available options for aQuestionSettings.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 5 months ago - 4 years 5 months ago #190805 by holch
As I said, I have no idea about the RC, but I assume if you just specify the the question id and the subquestion, limesurvey won't know what scale you are referring to.

How do you specify the subquestion in the iQuestionID? How does it look like?

For Expression manager I would access the answer options of a dual scale question the following way:
First scale
Code:
QuestionID_SubquestionID_0

So I am sure there is probably something similar for the RC. Let's see if someone with API experience comes here.

Wait, what is the LS version you are using?

bugs.limesurvey.org/view.php?id=13312

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Last edit: 4 years 5 months ago by holch.
The topic has been locked.
  • datamunger
  • datamunger's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 5 months ago - 4 years 5 months ago #190816 by datamunger
I'm using version 3.17.7

The documentation for get_question_properties is pretty sparse, but it states the following:

/**
* Get properties of a question in a survey.
*
* @see \Question for available properties.
* Some more properties are available_answers, subquestions, attributes, attributes_lang, answeroptions, defaultvalue
*
* @access public
* @param string $sSessionKey Auth credentials
* @param int $iQuestionID ID of the question to get properties
* @param array $aQuestionSettings (optional) properties to get, default to all
* @param string $sLanguage (optional) parameter language for multilingual questions, default are \Survey->language
* @return array The requested values
*/


The aQuestionSettings allow me to specify 'scale_id', but this simply returns '0' as a JSON response. A full example looks like this:
Code:
api.query(method=method, params=OrderedDict([
                        ("sSessionKey", api.session_key),
                        ("iQuestionID", '36849'),
                        ("aQuestionSettings", ['answeroptions', 'scale_id'])
                    ]))
returns:
Code:
{'answeroptions': 'No available answer options', 'scale_id': '0'}
Last edit: 4 years 5 months ago by datamunger.
The topic has been locked.
  • datamunger
  • datamunger's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 5 months ago #190817 by datamunger

holch wrote:
Wait, what is the LS version you are using?

bugs.limesurvey.org/view.php?id=13312


I've come across this as well, but at least that user got answeroptions for one of the scales, whereas I don't get any.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose