Question T3664
Visible to All Users

choicesVisibleIf based a on json data content

created 5 years ago

Hi,

Below a code that illustrates my problem.
I have this questionnaire JSON Code :

JavaScript
{ "title": "my questionnaire", "pages": [ { "name": "PAM_questionnaire", "elements": [ { "type": "dropdown", "name": "Target System", "choices": [ "system1", "system2, "system3" ] }, { "type": "checkbox", "name": "VerificationDelegation", "choices": [ "subsystem1", "subsystem2, "subsystem3", "subsystem4, "subsystem5", "subsystem6, "subsystem7", "subsystem8, "subsystem9" ] } ], "completeText": "Create/Update !" }

Now I would like to filter the "VerificationDelegation" questionnaire element choice list base on this json "database" :

JavaScript
[ { "system": "system1", "uses": ["subsystem1", "subsystem2", "subsystem3"] }, { "saosystem": "system2", "uses": ["subsystem4", "subsystem5", "subsystem6"] }, { "saosystem": "system3", "uses": ["subsystem7", "subsystem8", "subsystem9"] } ]

I would like to know how to "insert" in JSON Code of the question the JSON database above in order to be able to filter in the "VerificationDelegation" question element choices values using the choicesVisibleIf property.

It is may be trivial, but I'm not a JS developer at all.
Thank in advance for your help

Answers approved by surveyjs Support

created 5 years ago

Hello Joseph,
Here is the working example, that uses several functionalities of SurveyJS Library and some custom programming on JavaScript.

Thank you,
Andrew
SurveyJS Team

    Show previous comments (4)

      Hello Joseph,
      Yes, it is clear. Unfortunately we do not have the functionality you are asking for out of the box. The scenario is clear. The solution that we offer is to filter the data on the server. Here is the example of using restful services with our select questions.
      Unfortunately, I do not see a way how to filter custom data on client without writing some JavaScript code :-( We can add this functionality, client filtering out of the box, in the future, but again, it would require that data are created by some rules.

      Thank you,
      Andrew
      SurveyJS Team

        Thank you for help Andrew.

          You are welcome!

          Andrew
          SurveyJS Team