Dynamic row addition for question matrix grid theme

Hello everyone,

Is there a way to dynamically set the number of rows of a table to match a certain number in grid theme layout? Say the enumerator enters/selects the number of items to be described in a preceding table. Is there a way the number of rows can be dynamically adjusted to match the entered number of items? Each row will describe a particular item and all will be described with same columns. So the table will look exactly the same but differ in the number of rows (items) each enumerator inputs in his own form. e.g. One enumerator form can have a table with 4 rows for 4 items while another has 10 rows for 10 items after inputting this number as the desired number of entries/items.

I would love to hear any ideas or suggestions? Thank you.

Hi @marc
Welcome back to the forum. Do you mind sharing the example of the XLS form with this so that users can be able to try out different approaches?


Oh sure thing. I’m going to share it as soon as I get tou laptop in the morning.

Thanks Stephane.

I have created a sample XLSform attached. I would like to have the number of rows be linked to the number of fish input just before the table.
I haven’t written any code, it’s just something I was imagining to be quite useful if it were all possible.
Such a function would remove redundant fields when one is uncertain of the number of Similar entries that the enumerator will encounter.

I’m open to learning any strategies. Because the simplest solution would be have a fixed row number of your highest expected number but this would leave redundant rows in the case less fields are entered.

Thank you again.

fish counter.xlsx (11.4 KB)

@marc, the rows seems to be dynamic in your case. What about the column? Are they too dynamic or stagnant?

The dynamics I meant was referring to number of rows not width or height of the row. So I don’t believe that the rows are dynamic yet because I didn’t link the row number to the input value just above the table.

What I was envisioning is similar to Instantaneous row addition to match a previously inserted integer value. I believe this should be possible in enketo but I’m uncertain of the code necessary.

Any ideas?

@marc, please be informed that a matrix question always has a defined number of rows as the labels in the rows are pre-defined. However, you could still use the repeat group feature to make a dynamic row with a fixed number of column as discussed previously:

1 Like

Thank you. Let me try this out.

1 Like

@Kal_Lam let’s say that the number of rows that we want is defined with a count-selected calculation of a select_multiple question. Would it be possible to have the labels of the chosen elements in our repeat group questions ?

Hope it is clear !

@lastpierre, maybe this is something you are looking for that was discussed previously: