Retrieve and create objects with specializations

0
Hi! I am trying to create an app with a form that has several questions. In that app will be a page where some users can see the information of the questions in the form and even add new questions. There can be three types of questions, with the names: two options (Question_TwoOptions), list (Question_List) and insert value (Question_InsertValue). I created the Domain Model like this, and built each type of question as a specialization of ‘Question’ entity.   Now I want to: - Show in the same list all questions (of all types: two options, list and insert value) and put a label in each one specifying the type of question it is. - Create a form where the user can create a new question and choose what type of question he wants, from the given options.   Is it possible? Thank you!
asked
1 answers
1

Yes, this is possible out of the box using templates in a list view.

See the documentation: https://docs.mendix.com/refguide/list-view#templates 

Each template connects with a specific specialization and has its own specific UI setup, including labels

 

For creation of a new question you do have 3 options

  1. Add 3 create buttons, each for a specialization and page → kinda clumsy
  2. Add a single create button, which create a question (w/o specialization),
    Add a enum to the Question entity, covering all type of specializations.
    After create of object, show a page with dataview context Question and display enum selector, so that user can select type
    Add button “Next” which calls a microflow which creates a specialization based on the selected enum value and shows a related page, so that use can specify what needs to be specified
  3. Same as above, but instead of (mis-)using the question entity, use a non-persistent entity to catch the user input.
answered