Begin repeat with number 2

HEllo,
I have a question abut the repeat question.
I create a repeat question group like this:
begin_repeat
text
select_one pod
select_one podbeschreibung
end_repeat

At "select_one pod" i create a list under "choices" tab like this:
P 02
P 03
P 04
P 05
P 06
P 07
P 08
P 09
P 10

So what I want is, if the user create at the first time this repeat form, it should displays at "select_one pod" value "P 02", if he decide to create this repeat again (add it second time), at "select_one pod" there should displayed "P 03" and so on, next "P 04" and so on.
It is possible to limit the begin of the repeat at "P 02" and count it with every repeat +1 or is there another solution to begin with the value "P 02" and calculate it +1 for every repeat?
Thanks

Hi @Maggi

Could you tell us a little bit more about your case? Should that list (selec_one) be read-only so that users won't be able to change the answer that will be selected automatically in the way you have described?

Yes indeed, that scorrect decribed. It must not be a list, if it possible, that with everey repeat of the repeatgruuop (with every new repeat that will be added) a counter add a +1 to the value, that begins with 02 at first time.
THX

The function position(..) gives you the current repeat. See https://getodk.github.io/xforms-spec/#fn:position (and https://docs.getodk.org/form-logic/#repeating-questions). So you could simply add +1 to calculate your counter. Inside the repeat your number calculation would be. position(..) + 1.

But your full requirement is not clear to me. What is the relation and data consisteny of the 2+ persons to person 1?

Hint: The search option of this forum might provide other interesting hints and examples for your issue.

Hi @wroos : thx for your explanation and for your hint.
I dont understand the question, which person....? It is only a repeat like numbering, but begins with 2, not with 1, and count for everey new repeat one more... it is called P 01, P02, and so on....
THX

1 Like

There is probably also a person 01 in your survey. So, there might be data consistencies to control against the other persons, e.g. 01 is the (one) head of household etc.

Hi everybody. I'm sorry @Maggi by I'm also a little confused about the motivation of this requirement. Are you trying to avoid duplication in the pod's selection?

Hi,
I will try to explain it. It is a list of samples, and the samples begin, for a specific survey, with the number 02, and will descriebed with a "P" before (not a person) it is the shortcut of phytobenthos sample. So at one location (it is one survey) there can be collected one sample called "P 02", and than another sample named "P 03" and so on......it begin with the number 2, because the number one P 01 is reserved for all collected samples at the end.

Hi @Maggi,

By using the settings below you'll get a repeat structure that in each interation is restricting the pod options to a smaller list like you mentioned.

Hope it helps!

1 Like

Hi @rfvieira ,
this is a good solution and it works for me also.
THX regards

1 Like