Indexed-repeat used in a repeat nested in a repeat returns wrong value

#1

Hi community,

I have been looking extensively for solutions but can't find any, so I will try to explain my issue here and hope someone can figure out what is wrong. In advance thanks!

What is the problem? Please be detailed.
So. I am building a XLS form for fisheries catch monitoring. Several catch types are selected (i.e. tuna, mackerel, etc), then there is a set of repeated questions for each catch type selected (let's call it "catch_repeat"). Within this repeat group (catch_repeat), I have a nested repeat for individual lengths of each fish (length_repeat). Now this length_repeat question is repeated based on the number of fish per catch type, max. 5.
Now my issue is that the form works fine as such, expect that when publishing to GoogleSheets, the parentID for the length_repeat does not link to anything - I would assume it would link to a catch_repeat specific ID (for each catch type).

So, as I tried to fix that, I created a unique ID for each catch type in the catch_repeat (based on fisher name, time fishing etc).
Then I am using indexed-repeat in the length_repeat so that it returns that catch_repeat_ID, and I can then link the length_repeat data with the catch_repeat data on GoogleSheets.

Now after submitting data, and published on GoogleSheets, the length_repeat_ID that is returned for each length does not correspond to the catch type. Screenshot below (highlighted are what should be the different lengths of 3 catch types, however we can see the repeat_ID is not the same per catch type). It seems it is looping through the different catch_repeat_ID available, and I don't understand the error - is that due to the jr count setting for length_repeat? That it is a nested repeat?

Any help would be highly appreciated!

0 Likes

#2

Hi @Effy

sorry for the late response...

Do you mean that values in the PARENT_KEY don't equal any value in the KEY column of the parent sheet?
if so please attach your form for testing.

PARENT_KEY and KEY columns are added automatically, It should work out of the box and you shouldn't have to add such key pairs on your own.

0 Likes

#3

Hi @Grzesiek2010 !

Thanks a lot for your answer. Indeed the parent uid in the length_repeat tab (repeat nested in repeat) does not match any other key in the other sheets, hence why I tried to create another ID.

Attached the XLS form I've been working on. Com_ODK_Boatcatch_monitoring_2019_catchrepeat_v1.xlsx (103.8 KB)

Effy

0 Likes

#4

I downloaded and tested your form. Are you sure it's a form you tried?
I'm asking because:

  1. You have a group with a field-list appearance which contains a repeat group what is not allowed and I needed to remove the field-list appearance.
  2. As I said above you use a repeat group inside a regular group what caused problems on v1.19.0 and older versions, which we have fixed recently and it will be available in v1.20.0 https://github.com/opendatakit/collect/issues/2896
    so to test your form I did have to use a beta version which includes the fix.
  3. The third issue was too long sheet title - we create another sheet title for repeat groups. The name is based on the form name + group name and it can't be longer than 100 chars. Your form name is long so it caused problems and I had to change it as well.

Finally, I prepared this form:Com.xml (41.4 KB)

I tried to send your form and analyzed keys. They seem ok to me. Take a look:

I added colors to highlight the same values.

1 Like

#5

Thank you so much @Grzesiek2010 !

I might have sent you an earlier version of the form... Though I made sure to test it before sending out, but sorry if I've sent the wrong version. Indeed I had the error of the group with field-list appearance containing a repeat group - so I had removed the field-list appearance as well.

I'll make sure to download the latest version. It seems the different variable names are created differently - before the group names did not appear.

Taking advantage of the opportunity, I was wondering if the groups we are using are relevant/necessary? Eg the "fisher agree" group. I feel like this does not bring anything to the database/form, considering how data is laid out on google sheets and that we use one question per screen on ODK (questions not grouped on one screen).

Many thanks again!

Effy

0 Likes

#6

Regular groups without field-list appearance are usually used just to make the xls form more readable I think. It's not necessary.

0 Likes

#7

@Grzesiek2010... I still encounter the same error (parent uid not linked to previous repeat id) even with the v1.20 ?! Attached the modified form I have used (I removed the groups).
Com_Boatcatch_2019.xml (62.4 KB)

The spreadsheet you shared also looks different (key/parentkey) and not uuid.

Am sorry if being a bother, but I don't understand where the issue might come from. Thanks in advance!

Effy

0 Likes

#8

Could you attach a link to your form to show your results? In my case again everything seems fine:

0 Likes

#9

It is as if I still have the older ODK version? Although I downloaded the v1.20 and it looks different on the Android (than the previous version). Can that be an issue with the publishing to Google Sheets from the appspot?

Below the GoogleSheet

0 Likes

#10

Where are your PARENT_KEY and KEY columns? They are created automatically did you removed them?

0 Likes

#11

They just don't appear... That's the Google sheets that is published from the appspot server. Is that due to the fact that server is on Aggregate? So forms are uploaded there and then published to Google sheets?

0 Likes

#12

ahhhhh it's from aggregate... I thought it's a sheet filled from ODK Collect. So maybe @ggalmazor can help here.

1 Like

#13

Ok sorry I had not made that clear before. Thank you very much for your help @Grzesiek2010 !

Hi @ggalmazor! :slight_smile:

1 Like

#14

Hi, @Effy!

I see that there's been some discussion as to the form's structure at this point. Before starting to study this, could you link to the right form we can consider is OK and helps to reproduce the issue you've described?

0 Likes

#15

Here is a working XLS version below. The only issue is that the uuid from the nested repeat does not link to a parent ID in the "higher" repeat (as illustrated in the first screenshot I sent).
Com_Boatcatch_2019.xlsx (99.7 KB)

XML version below
Com_Boatcatch_2019.xml (62.4 KB)

Thanks!

1 Like

#16

Thanks! I'll take a look

0 Likes

#17

Hi, @Effy!

Sorry for taking so long! Could you send me some submissions that reproduce the issue you're describing, please? You could use Briefcase to push the form to the sandbox and then I can pull it to my computer if you want.

0 Likes