Filtering empty options in select_multiple

Hello,

I’m trying to create a select_multiple list like this post:

The expected behavior is that the options in num_partida_fin is the list of num_partida_inicio inputs. The problem is that if tipo_registro is different from ‘inicio_partida’ (i.e: paro) a new repeat iteration is created with no num_partida_inicio so the list in num_partida_fin has empty options and some non-empty options are not shown because
cant_part is not incremented.
I think the best approach would be filtering out the empty options but I can’t find the way to do that.
Is there any way to avoid the empty options so the num_partida_fin show the correct options?

Thanks
PLP blanks.xlsx (14.8 KB)

@jventayol, did you mean the Start Game should not display in the next record if that is already been selected in the first record as shown in the image below?

Feel free to share with me a screenshot if it’s something different.

Hello @Kal_Lam,
Not quite. Sorry for not being clear enough.
This is a screenshot of the expected behavior where the options in num_partida_fin are all numeric and they all are the num_partida_inicio different inputs :


But when I select:

  • Inicio Partida (1st iteration)
  • Paro (2nd iteration)
  • Inicio Partida (3rd iteration)

And then Fin Partida in the 4th iteration then the option list in num_partida_fin has a blank option which should be filtered out

That’s because indexed-repeat(${num_partida_inicio},${registro}, 2) calculation (partida2 question) is an empty record.

I can think about 2 possible solutions (theoretically):

  • Filtering out the empty fields - This will lead in deleting current filter=${cant_part} as it would be redundant
  • Dinamically feed the position in indexed_repeat by (somehow) storing the position(..) only when inicio_partida is selected in tipo_registro. It should be stored every time inicio_partida is selected (should be in different variables)

Problem is I don’t know how to implement either solution or if those solutions are doable in Kobotoolbox.

Is it possible? Do you haver any other idea?