Dynamic widgets or branching depending on user interaction

0
Hello Community,    i´m quite new to Mendix but have accomplished the rapid developer course and gained some experience.    For my app one part is that i can provide some kind of editor to create an questionnaire/checklist/survey. What really would fit best it the functionality of microsoft forms. There it is possible to add a new entry by selection what is needed: - Text - Selection - Date and you can specify at the end regarding what the user is selecting where you want to jump in the questionnaire.   For example if there is an selection with radio buttons when the user select the first one it continues 5 questions below and by the other choice 10 questions below.    As far is i have learned and understood so far in Mendix i have only the possibility to predefine the page layout and can make the widgets visible / editable but i´m not able to create them dynamic.    I already have looked in the academy regarding smart pages and also found one interestign marketplace module Questionaire. But nevertheless this app also allows me only to create a survey and then go through it without branching oder jumping in the survey regarding the selections.   Do you have some helpful informations for me how i could make something like that in Mendix? Thank you very much in advance.
asked
1 answers
0

Hi Markus,

 

An option would be to create “layers” in your questionnaire, and use that layer structure to make questions dependent on other questions. You can accomplish this by viewing a question as a more generalized “Element” entity (e.g. the object can be of type (stand-alone) question, but also a text block or a category), then using one or more self-references to create the layer structure between the Elements in the questionnaire. Then in your questionnaire set-up, you can define on runtime that e.g. Question B belongs to Question A. 

 

 

In the example below, I defined that this question belongs to subcategory “Scaffold”, which is a subcategory of the category “Collective fall protection” (2 layers deep). Using custom on-change logic and conditional visibility, I can make the dependent questions irrelevant and hidden when they are not in scope:

 

\

Questionnaire with scaffold answered “yes”

 

 

Questionnaire with scaffold answered “no”:

 

Hope that helps.

answered