Default ID to position in group within group

Hi there, maybe a silly question, but is it possible to put the default value for an id as the position it is in in the repeat group? For instance, for the first entry in the repeat group, I would like the ID to default to 1, the second entry to have a default ID of 2, etc.

This is what I’ve got so far:

Welcome to the community, @cambrael! You should be able to do it as outlined in the post discussed previously:

Thanks @Kal_Lam. I have a follow-up question. My group (Stems) is actually in another repeat group called Trees. Is it possible to use both their positions to produce a Stem ID as follows?

Tree: 1 Stem: 1 ID: 1
Tree: 1 Stem: 2 ID: 2
Tree: 2 Stem: 1 ID: 3
Tree: 3 Stem: 1 ID: 4
Tree: 4 Stem: 1 ID: 5
Tree: 4 Stem: 2 ID: 6
Tree: 5 Stem: 1 ID: 7
Tree: 5 Stem: 2 ID: 8
Tree: 5 Stem: 3 ID: 9

This is what I’ve got so far:

But as you might suspect, it is producing:

Tree: 1 Stem: 1 ID: 2
Tree: 1 Stem: 2 ID: 3
Tree: 2 Stem: 1 ID: 3
Tree: 3 Stem: 1 ID: 4
Tree: 4 Stem: 1 ID: 5
Tree: 4 Stem: 2 ID: 6
Tree: 5 Stem: 1 ID: 6
Tree: 5 Stem: 2 ID: 7
Tree: 5 Stem: 3 ID: 8

Many thanks,
Cambrael

@cambrael, maybe cancat would be an better approach here. You should be able to learn more about concat here.

Hi @Kal_Lam, I tried a concat on the tree and stem numbers and it returned:

Tree: 1 Stem: 1 ID: 11
Tree: 1 Stem: 2 ID: 12
Tree: 2 Stem: 1 ID: 21
Tree: 3 Stem: 1 ID: 31
Tree: 4 Stem: 1 ID: 41
Tree: 4 Stem: 2 ID: 42
Tree: 5 Stem: 1 ID: 51
Tree: 5 Stem: 2 ID: 52
Tree: 5 Stem: 3 ID: 53

Perhaps I misunderstood? I just need to return an ID 1, 2, 3, 4, 5, 6, 7, 8, 9…

@cambrael, maybe you could also try this approach discussed previously:

Hi @Kal_Lam. I tried doing a concatenate, but I guess what I’m really looking for is some sort of incremental ID, based on the entry of the last ID. I also tried what @Josh suggested below, but it kept returning 1 every time.

Hi @cambrael, perhaps my example here is closer to what you’re looking for?

1 Like