How to Dynamically Add Columns in Outysystems?
Question
Application Type
Reactive
Service Studio Version
11.11.13 (Build 47944)

I am building a matrix question within a dynamic survey question.


The Survey is build based on a Entity Value Attribute.


Form ( entity)

Id,

name,

startDate

endDate

IsMatrix



FormQuestion (entity)

Id

formId

questionType: (text,checkbox,radio...)

question

subId(the matrixId ) 


FormResponse(entity)

Id,

formId

formquestionId

applicationId

studentId

subId

value 



Looking at Question 3, the matrix question is displayed as rows, but it should be displayed as columns dynamically.



The original question should be like this

In this figure, the User should be able to add #4, #5 with a button called Add Row, and  a new column with a button next to appendix No with a X indicating to delete the specific Row.



Currently, I can only display the matrix questions into a row format, is this possible to create a dynamic column?

Figure, Admin Interface Showing matrix and select the Matrix Question Set 


What I have now for matrix questions is 

1. Define a new Form

2. Check the isMatrix option

3. Create Creations

4. Save Questions



Inside the desired Form 

Select question Type as matrix

Select the Matrix Question 

Display the matrix question 



Components Attempted

(Table Record )-- Requires definite Columns to be defined in design.

This is not possible, because users may add a matrix question within a survey question  that can be 

   - a 5 point Likert scale 

    - a custom matrix questions, each field requires custom data validations

 -  each column may have multimodal input e.g. radio/checkbox/ file upload


(Data Grid)

  It only displays data in a grid of a tabular table with fixed column only. 

It is similar to dataTable library in javascript that allows onclick events actions and table header column sorting.



(Dynamic  Table)

  It only generates the rows and columns but unable to loop data and generate desired results.


(Dynamic Form)

  It only supports Simple Survey.  I already successfully created a Survey using the Entity Attribute Value Model.

I am creating a matrix question within a dynamic survey form.

e.g. Question 1 

       Enter your Name 

e.g. Question 2

        Do  you like this class   ( 1 least like .... 5 Like this class the best)

        Is the work load sufficient  ( 1 least like .... 5 Like this class the best)

e.g. question 3 

         See Figure Above stated Education Background. 



Solution

Solution is to Use Multiple Block for nested Components


(Screen) Form Questions

    (Block)Matrix

       (Block)Matrix Question

                    (Block)Checkbox

                    (Block) Radio


Screen of Service Studio


The OML and other Client Actions, Aggregate and Server Actions are Omitted for simplicity.



Screenshot of Matrix Questions 

One Question 

  Allow Add Row ( dynamically) Record #1

 Allow Delete Form Response, Form Record



The Entire Survey Looks Like this

       

Hi Calvin,

You can use dynamic table forge component or use dynamic form to add new input field in form.

Either you can put the input widget into list. Add button to add one more row to the list.. then the list will be created with input widget.

Thanks Aadhavan S

Thanks for your reply.

First, dynamic table and dynamic form are for traditional web component.

I am  currently using reactive.

Second, I would like to transverse rows to columns dynamically. 

Each Columns has data that are dynamic.   The dynamic table only generates the number of rows and columns but it seems it could not allow me to loop over my data fetched from an aggregate.


(Dynamic Form)

  It only supports Simple Survey.  I already successfully created a Survey using the Entity Attribute Value Model.

I am creating a matrix question within a dynamic survey form.

e.g. Question 1 

       Enter your Name 

e.g. Question 2

        Do  you like this class   ( 1 least like .... 5 Like this class the best)

        Is the work load sufficient  ( 1 least like .... 5 Like this class the best)

e.g. question 3 

         See Figure Above stated Education Background. 


Solution

Solution is to Use Multiple Block for nested Components


(Screen) Form Questions

    (Block)Matrix

       (Block)Matrix Question

                    (Block)Checkbox

                    (Block) Radio


Screen of Service Studio


The OML and other Client Actions, Aggregate and Server Actions are Omitted for simplicity.



Screenshot of Matrix Questions 

One Question 

  Allow Add Row ( dynamically) Record #1

 Allow Delete Form Response, Form Record



The Entire Survey Looks Like this

       

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.