Question T2074
Visible to All Users

setVariable with object

created 6 years ago

Hi, I'm wondering can we use survey.setVariable with value is an object, and how we can use that in json of surveyjs?
Another question, with choicesByUrl, the properties titleName, valueName, can we access that with some syntax like JsonPath or Xpath, or something else?
Ex: the response from Url is an object, there is an array in that object. And I just want to set titleName with a specific element in that array.
Thank you

Answers approved by surveyjs Support

created 6 years ago

Hello,
We have defaultValue property that will be set to the question on loading the JSON.
Regarding choicesByUrl, without seeing your service and your properties, it is hard to suggest something.

Thank you,
Andrew
SurveyJS Team

    Show previous comments (1)

      Hello,
      Sorry, I did not get it.
      Here is the example of using defaultValue.

      Thank you,
      Andrew
      SurveyJS Team

        I know how to using defaultValue :(
        I just don't know do we support setVariable with an object or not? (First question)

          Why do you need it? I do not get it. You should assign value of the choice item (ItemValue class) and not other properties.

          Thank you,
          Andrew
          SurveyJS Team