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

Is below what you need?

1 Like

Yes! This is it. Thanks! :slight_smile:

Hi @ggalmazor,

Hope you are well? Just catching up to see if you could find out what the issue was with the nested repeat...



Hi, @Effy!

I'm sorry I haven't had any time for this during the last month. It's on my to-do list, though, and I expect to have some time during July

Hellooo @ggalmazor,

How are you? Following up to check if you had some time to look at this nested repeat issue?



Thanks for reminding me about this, @Effy! I'm sorry that I forgot about it :confused:

I'll try to take a look next week. Pinky swear it :wink:

Hi @ggalmazor !

I think your pinky tricked you :slight_smile: Sorry if I am pushing! But turns out, other colleagues of mine had the same issue I mentioned, so would def be very keen to know if there is a solution/workaround.



1 Like

Sorry! I will stop making excuses and take a look right now!

@ggalmazor, I just meant to send a gentle reminder/get update, attempting a joke :slight_smile: Hope it passed as such. Am very glad you're taking the time for this!

1 Like

Not at all, don't worry! Also, thanks for your patience. Not many issue reports get backlogged so much, and that's on me.

I'll take the chance and report that I've done a quick sanity check with Briefcase to see the shape of the data you've shared. So far, so good. Now I'm trying to get Aggregate to publish stuff to Google sheets :stuck_out_tongue:

What version of Aggregate are you running?

OK, managed to publish the form here

Hi, @Effy!

I think I'm not understanding the whole workflow you're following. Are you using Aggregate to publish the form to Google Sheets? In that case, I can't reproduce your issue. This is a GIF of me navigating the published data:

(Don't mind the change of IP address in the GIF. It's because I'm running it Aggregate on my computer)
(Exporting the form to CSV using Aggregate and then importing it as a new spreadsheet gives the same results)

I've also exported the form using Briefcase and I can like each files PARENT_KEY column values to their corresponding parent file's KEY values, so I can link every piece of data up to the main CSV file.

Could you describe the steps you do to reproduce the issue detailing whichi tool you use for each step, please?

Hmmm I think I got confused in my previous answers. I get the same result you did, my issue being that when publishing to Google Sheets directly from the Aggregate server online (appspot), there is no "direct" parent_id that can be used to link the length_repeat data with the catch_repeat.

I understood that when using Briefcase, there is a PARENT_KEY value appearing, but I did not want to have to use Briefcase... (for several reasons, this is meant to be shared/used by other colleagues)

Is there no way to have the length_repeat ID link with the catch_repeat on GoogleSheets? That links me back to my first post, as I've tried to create a specific ID while designing the form, to link the catch_repeat and length_repeat - and failed :slight_smile:

Hoping this is clear

OK, I think we've zeroed on the issue now :slight_smile:

Aggregate doesn't export/publish those KEY/PARENT_KEY values like Briefcase. Aggregate exports and published data is meant to be navigated manually (like I do in the GIF I've attached). This limitation is especially obvious when you have repeat groups, like yourself.

In your case, I think you should have to change your workflow and include Briefcase to pull the form, extract some CSV files and then import them into Google Spreadsheets. That way, you'll get all those KEY/PARENT_KEY values you need to link data together.

Argh, ok - that is what it seemed like, but I had hoped there was a way through Aggregate, or at least could not have a clear confirmation until now. Good to know!

But going back to my first post, do you have an idea why I get this error when creating a custom ID myself?

Thanks for your time!

Can you please share the exact indexed-repeat call you tried? I would have expected something like indexed-repeat(${catch_repeat_ID}, ${catch_repeat}, position(../..)) but I just realized that this appears to be broken for nested repeats. I will investigate further and report back (tech details: this is because the conversion for XLSForm now puts a relative reference for ${catch_repeat_ID}).

In the mean time, you should be able to use ../../catch_repeat_ID for your calculation instead of a call on indexed-repeat. The first .. means "go up one level from the current question", the second .. means "go up one level out of the length_repeat" and catch_repeat_ID should get you to the value that you need.


Sorry my answer is late, but thank you for looking into it.

I have used indexed-repeat(${catch_repeat_ID}, ${catch_repeat},position(..)-1) .

Have tried with your suggestion (in the calculation field, using "../../catch_repeat_ID"), but I can't upload the form on the server.
Error: Problem with JavaRosa Parsing Form: org.opendatakit.aggregate.exception.ODKIncompleteSubmissionData: Javarosa failed to construct a FormDef. Is this an XForm definition?

Although it does upload with previous indexed-repeat.

Let me know if you come across something else,

Many thanks


What version of Aggregate are you running? Are you on AppEngine?

It is on AppEngine yes!