Welcome to the LimeSurvey Community Forum

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

RPC / API: set attributes with set_question_properties

  • FherStk
  • FherStk's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 8 months ago #241568 by FherStk
Please help us help you and fill where relevant:
Your LimeSurvey version: Versión 3.21.1+191210
Own server
Survey theme/template: based on vanilla
==================
Dear community,

I'm copying a survey calling the API via C# and I'm trying to change some survey/question data. I'm able to change almost everything except two things:
  • Critical: I need to change the "equation" value under "attributes" for some questions. I can change the "question" value with no problems, but I can't change anything under "attributes". 
    • Works: sending this JSON as "aQuestionData" changes the "question" value: 
      {
         "question" : "degree: {'MY_VALUE'}"
      }
    • Doesn't work: Sending this JSON as "aQuestionData" does not change the "equation" value:
      {
         "attributes" : {
            "equation": "{'MY_VALUE'}",
            "hidden": "1"
         }
      }
  • Optional: I would like to change the survey group, but I wasn't able to find a valid option to do that using the API.
Please, could you help me?

Thanks in advance,
Fher

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
1 year 8 months ago #241626 by DenisChenu
I think this topic can be in development

> Critical: I need to change the "equation" value under "attributes" for some questions. I can change the "question" value with no problems, but I can't change anything under "attributes". 

I think you can't update attribute : github.com/LimeSurvey/LimeSurvey/blob/ca...rol_handle.php#L1765

>  Optional: I would like to change the survey group, but I wasn't able to find a valid option to do that using the API.

You can't via API : github.com/LimeSurvey/LimeSurvey/blob/ca...rol_handle.php#L1793

2 solution :
- Use import_question function
- Create your own update function , make a Feature request and a pull request ( but you can use your own function before it was merged )

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The following user(s) said Thank You: FherStk

Please Log in to join the conversation.

  • FherStk
  • FherStk's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 8 months ago #241627 by FherStk
Thanks a lot for your feedback, I'll try with import_question :)

Please Log in to join the conversation.

  • FherStk
  • FherStk's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 8 months ago - 1 year 8 months ago #241638 by FherStk
Hi,

I was able to create a new survey with import_survey, using an exported one as a template. I was able to do everything I needed but setting up the "survey group/section".

I can see the correct "gsid" within the CSV/TXT file, but once imported, the survey is assigned to the "Default" section.

It is possible to setup this value using the current API?

Thanks again,
Fher
Last edit: 1 year 8 months ago by FherStk. Reason: Clarification

Please Log in to join the conversation.

  • FherStk
  • FherStk's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 8 months ago #241763 by FherStk
I answer myself: yes, with 'set_survey_properties' and setting the "gsid" after the survey has been created.

Thanks for all your help :)
Fher
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose