Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decrease in Repeat_count while filling in #868

Closed
ahelmi365 opened this issue Apr 11, 2017 · 12 comments
Closed

Decrease in Repeat_count while filling in #868

ahelmi365 opened this issue Apr 11, 2017 · 12 comments
Labels

Comments

@ahelmi365
Copy link

If we have some questions to be repeated as a loop, we put them under “begin repeat” and we set the number of repeat based on an answer of a previous question under repeat_count

For example:
Q1. How many people are there living in your household?
for example the answer is: 5

Then we want to ask some questions about gender, age for all 5 members.

The problem is that if we enter 5, for example, in Q1, then we continue answering all questions under the loop until we reach iteration number 5, then if we realize that they are only 4 NOT 5, so we go back and change this value to be 4 instead of 5 in Q1, but after continue, it still repeats 5 times based on the value we entered at the first time in Q1.

So we want the repeat to able to repeat according to the current/latest value in the question we use in repeat_count.

All the Best

@mdudzinski
Copy link

Hi @alihelmi87
I think this issue is related to the javarosa core library. I already reported it as getodk/javarosa#45 with some technical research.

@lognaturel
Copy link
Member

@alihelmi87 Have you taken a look at the section on "repeat-groups are not respecting the jr:count setting after a change" here?

Thanks to @alihelmi87 we've started a discussion on how to address this at getodk/javarosa#45. The big question is whether we do want to risk giving users the possibility to delete potentially a lot of data.

@lognaturel
Copy link
Member

I'll add also that there's interest in a more significant change to the repeat group UI (#809) so perhaps we'd be better off addressing this issue once through that more thorough redesign.

@ahelmi365
Copy link
Author

Hi @lognaturel @mdudzinski

First of all thank you for working on this.

I wanted you to know that I use XLS form to create/design our surveys. I looked at the Gotchas and Workarounds and was wondering if you mean to apply these changes in the XML file or not!

How to apply the same idea on the XLS form?

What you can do is nest a simple group immediately within the repeat group, e.g., /data/repeater/guard and place a relevant condition on that group: position(..) <= /data/count.

I have uploaded my XLS form that contains a sample here, can you please look on it and explain how to implement your suggestion?

Looking forward to hearing form you.

All the Best,

Ali Helmi

@yanokwa
Copy link
Member

yanokwa commented May 18, 2017

@alihelmi87 I've implemented the approach as described on the Gotchas page and highlighted those lines in red. You can find the form here: testRepeatCount.xlsx.

This hides the "deleted" group, but it still exists (e.g., if you go to the jump menu, you can see it, but accessing it will throw an error).

@ahelmi365
Copy link
Author

@yanokwa Thank you so much.

As I understood, we put the questions in a group to control the number of how many positions should be created, Am I right?

All thanks to @mdudzinski and @lognaturel for working on this, much appreciated.

@lognaturel
Copy link
Member

lognaturel commented May 18, 2017

Putting the questions in a group lets you make each group relevant only if that group's count doesn't exceed the total number of repeats specified. For example, if you initially had 5 repeats of the group and then changed the desired count to 3, repeats 1, 2 and 3 would be relevant and thus shown but repeats 4 and 5 would not be relevant and thus hidden. I hope this explanation makes sense, I'm having a bit of trouble describing it!

@ahelmi365
Copy link
Author

@lognaturel This is very clear, I got the point.
Thank you for explanation and helping on this. I ma really happy to reproduce this issue to my colleagues and it's solved :)

I have 3 questions, is it okay to post them here?

@lognaturel
Copy link
Member

Great, I'm happy to hear that, @alihelmi87! I'm going to leave this issue open for now because @mdudzinski is exploring actually deleting those extra groups rather than hiding them.

For general ODK questions, please write to the user's mailing list. For behavior that you think might be incorrect/bugs, please file separate issues!

@getodk-bot
Copy link
Member

ERROR: This issue is in progress, but has no assignee.

1 similar comment
@getodk-bot
Copy link
Member

ERROR: This issue is in progress, but has no assignee.

@lognaturel
Copy link
Member

I'm going to close this in favor of getodk/javarosa#45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants