How to pass dynamic value on repeat_count field?

If i pass dynamic value from an external app the repeat count is not working.

Hi @jovel

could you explain your problem better? I don't really understand what's going on.

Hello @Grzesiek2010 , the goal is to pass a dynamic value for repeat_count under repeat group. lets say the value is coming from an external app. Can we control that programmatically with a setter?

It's not possible to pass such a value using an external app. You can specify repeat_count with a number like you have in your example or using a value from another question or calculation (from the same form) and that's all.

You may be able to accomplish this using an external app to populate this 'another question'. See Launching external apps to populate single fields.

[disclaimer: I've not tried this myself, but its probably worth investigating. - Gareth]

I was able to achieve it, but i encountered problem when displaying the question under the repeat group. On the hierarchy view the counts are correct, but when i load the repeat section it was skipping the questions. Will update you accordingly currently checking it.

Great! Could you describe how? (for the benefit of our listeners... :slight_smile: )

Ok, now I understand your problem better.

You can try this form: counter.xlsx (5.3 KB)

with: ODK Counter

It allows to take a number form ODK Counter and set up repeats based on that value.

Hello @Grzesiek2010 , thanks for the sample, I am confuse on this part of the field:

ex:org.opendatakit.counter(form_id='counter-form', form_name='Counter Form', question_id='1', question_name='Counter 1')

question_id is the name of a specific type or name?
question_name is the label itself?

I downloaded ODK Counter on the playstore, but it seems that ODK Counter is intended to used from ODK Collect.

Can i pass/populate a value from an external app to ODK Collect using the appearance field on the xls?

As you can see here

ODK Collect starts an external app (for example yours)
and here

waits for a result.
The Key is always a word value so if you create your own app you can return a value to ODK Collect with that key and it should work.

When it comes to those parameters used by ODK Counter you can find an explanation here

They are used only for that app (ODK Counter) but if you have your own external app you might need different parameters or even zero I don't know it depends on your external app.