Save repeat results to a case

Hi All,

Can you save the entries of a repeat group as case properties? I know you
can use these to create child cases but I was wondering if it was possible
to save these to the parent case?

Kind regards,

Hello,

Unfortunately I do not think that saving repeated properties to the primary
case is currently possible.

Apologies,
Will

··· On Sun, Jul 31, 2016 at 1:50 AM, Sam Phiri wrote:

Hi All,

Can you save the entries of a repeat group as case properties? I know you
can use these to create child cases but I was wondering if it was possible
to save these to the parent case?

Kind regards,

--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I was just working on this myself. Your use case might be different from
mine, but I do believe it is possible to save entries of a repeat group as
case variables.

I did this in a few steps:

  1. Create a hidden variable inside the repeat group called repeat_index. I
    set my calculate condition to: position(..) + 1. This keeps track of what
    iteration the repeat group is on (I add 1 because the position() function
    is zero-indexed).

  2. I instantiated 5 hidden variables called case_value_1, case_value_2,
    case_value_3, case_value_4, case_value_5 to capture the variables inside
    the repeat group that I wanted to keep track of. (My repeat group repeats
    exactly 5 times. So I know that there will be 5 instances of the variable I
    want to capture inside the repeat group. If your repeat count is not
    static, you may need to adapt these instructions.)

  3. For each of the hidden variables, I set the calculate condition as
    follows:
    case_value_1 = #form/repeat_group/value_to_save[
    #form/repeat_group/repeat_index = 1]
    case_value_2 = #form/repeat_group/value_to_save[
    #form/repeat_group/repeat_index = 2]
    case_value_3 = #form/repeat_group/value_to_save[
    #form/repeat_group/repeat_index = 3]
    case_value_4 = #form/repeat_group/value_to_save[
    #form/repeat_group/repeat_index = 4]
    case_value_5 = #form/repeat_group/value_to_save[
    #form/repeat_group/repeat_index = 5]
    By selecting the value within the repeat_group with a specific
    repeat_index, I am able to capture each of the values I want in separate
    hidden variables.

  4. Now that you have extracted the case_values from the repeat group, it is
    easy to save case_value_* as case variables in the case management section
    of your form.

I hope that helps! Let me know if you have any questions, and check out
this page on repeat groups for more documentation:
https://confluence.dimagi.com/display/commcarepublic/Using+Repeat+Groups+in+the+Form+Builder

Thanks,
Jessica

··· On Sunday, July 31, 2016 at 11:20:15 AM UTC+5:30, Sam Phiri wrote: > > Hi All, > > Can you save the entries of a repeat group as case properties? I know you > can use these to create child cases but I was wondering if it was possible > to save these to the parent case? > > Kind regards, >

Thanks Jessica,

Yeah that looks like a good workaround. Will try it and provide feedback.

Kind regards,

··· On Sunday, 31 July 2016 07:50:15 UTC+2, Sam Phiri wrote: > > Hi All, > > Can you save the entries of a repeat group as case properties? I know you > can use these to create child cases but I was wondering if it was possible > to save these to the parent case? > > Kind regards, >

One additional note. If your repeat count is not fixed, you can still save
a comma-separated list of all the responses that you've solicited in your
repeat group. Just create a hidden variable with the following calculate
condition:
join(", ", #form/repeat_group/value_to_save)

··· On Tuesday, August 2, 2016 at 10:40:00 AM UTC+5:30, Jessica Long wrote: > > I was just working on this myself. Your use case might be different from > mine, but I do believe it is possible to save entries of a repeat group as > case variables. > > I did this in a few steps: > 1. Create a hidden variable inside the repeat group called repeat_index. I > set my calculate condition to: position(..) + 1. This keeps track of what > iteration the repeat group is on (I add 1 because the position() function > is zero-indexed). > > 2. I instantiated 5 hidden variables called case_value_1, case_value_2, > case_value_3, case_value_4, case_value_5 to capture the variables inside > the repeat group that I wanted to keep track of. (My repeat group repeats > exactly 5 times. So I know that there will be 5 instances of the variable I > want to capture inside the repeat group. If your repeat count is not > static, you may need to adapt these instructions.) > > 3. For each of the hidden variables, I set the calculate condition as > follows: > case_value_1 = #form/repeat_group/value_to_save[ > #form/repeat_group/repeat_index = 1] > case_value_2 = #form/repeat_group/value_to_save[ > #form/repeat_group/repeat_index = 2] > case_value_3 = #form/repeat_group/value_to_save[ > #form/repeat_group/repeat_index = 3] > case_value_4 = #form/repeat_group/value_to_save[ > #form/repeat_group/repeat_index = 4] > case_value_5 = #form/repeat_group/value_to_save[ > #form/repeat_group/repeat_index = 5] > By selecting the value within the repeat_group with a specific > repeat_index, I am able to capture each of the values I want in separate > hidden variables. > > 4. Now that you have extracted the case_values from the repeat group, it > is easy to save case_value_* as case variables in the case management > section of your form. > > I hope that helps! Let me know if you have any questions, and check out > this page on repeat groups for more documentation: > https://confluence.dimagi.com/display/commcarepublic/Using+Repeat+Groups+in+the+Form+Builder > > Thanks, > Jessica > > On Sunday, July 31, 2016 at 11:20:15 AM UTC+5:30, Sam Phiri wrote: >> >> Hi All, >> >> Can you save the entries of a repeat group as case properties? I know you >> can use these to create child cases but I was wondering if it was possible >> to save these to the parent case? >> >> Kind regards, >> >

Jessica or Will ? I have a similar request to do this as well but have not
been able to find the correct set up.

I have a question list group followed by a repeat group that is a notes
sections.......basically a text field.

I want to use the join function to do the following.

join("

", #form/Task_Details/memo)

and use this to give me a line separated text field which i can assign to
my case property..........

I have a hidden field right after the repeat group that uses the join as
the default value............this should work.........?

so if my first repeat is "My notes" and my second repeat is "More Notes"
the hidden field should show me

My notes
More Notes

Any ideas?

··· On Tuesday, August 2, 2016 at 12:36:10 AM UTC-7, Jessica Long wrote: > > One additional note. If your repeat count is not fixed, you can still save > a comma-separated list of all the responses that you've solicited in your > repeat group. Just create a hidden variable with the following calculate > condition: > join(", ", #form/repeat_group/value_to_save) > > On Tuesday, August 2, 2016 at 10:40:00 AM UTC+5:30, Jessica Long wrote: >> >> I was just working on this myself. Your use case might be different from >> mine, but I do believe it is possible to save entries of a repeat group as >> case variables. >> >> I did this in a few steps: >> 1. Create a hidden variable inside the repeat group called repeat_index. >> I set my calculate condition to: position(..) + 1. This keeps track of what >> iteration the repeat group is on (I add 1 because the position() function >> is zero-indexed). >> >> 2. I instantiated 5 hidden variables called case_value_1, case_value_2, >> case_value_3, case_value_4, case_value_5 to capture the variables inside >> the repeat group that I wanted to keep track of. (My repeat group repeats >> exactly 5 times. So I know that there will be 5 instances of the variable I >> want to capture inside the repeat group. If your repeat count is not >> static, you may need to adapt these instructions.) >> >> 3. For each of the hidden variables, I set the calculate condition as >> follows: >> case_value_1 = #form/repeat_group/value_to_save[ >> #form/repeat_group/repeat_index = 1] >> case_value_2 = #form/repeat_group/value_to_save[ >> #form/repeat_group/repeat_index = 2] >> case_value_3 = #form/repeat_group/value_to_save[ >> #form/repeat_group/repeat_index = 3] >> case_value_4 = #form/repeat_group/value_to_save[ >> #form/repeat_group/repeat_index = 4] >> case_value_5 = #form/repeat_group/value_to_save[ >> #form/repeat_group/repeat_index = 5] >> By selecting the value within the repeat_group with a specific >> repeat_index, I am able to capture each of the values I want in separate >> hidden variables. >> >> 4. Now that you have extracted the case_values from the repeat group, it >> is easy to save case_value_* as case variables in the case management >> section of your form. >> >> I hope that helps! Let me know if you have any questions, and check out >> this page on repeat groups for more documentation: >> https://confluence.dimagi.com/display/commcarepublic/Using+Repeat+Groups+in+the+Form+Builder >> >> Thanks, >> Jessica >> >> On Sunday, July 31, 2016 at 11:20:15 AM UTC+5:30, Sam Phiri wrote: >>> >>> Hi All, >>> >>> Can you save the entries of a repeat group as case properties? I know >>> you can use these to create child cases but I was wondering if it was >>> possible to save these to the parent case? >>> >>> Kind regards, >>> >>

Hi John,

A couple of issues stand out to me:

  1. It's not clear to me how to create a newline-separated list in CommCare.
    Newlines are usually special characters that can't be represented just by
    typing RETURN in between two quotation marks. I would try using a space
    separator (join(" ", #form/Task_Details/memo)) to see if that gives you
    some version of what you want, and then separately think about how to add
    the newlines.

  2. You should be entering this calculation into the Calculate Value rather
    than the *Default Value *of your hidden variable.

  • *Default Values *are static, and only calculated once when the form
    opens. If you assign join(" ", #form/Task_Details/memo) to a default value,
    it will always be blank (the value it had before the form was filled out).
  • *Calculate Values *are calculated dynamically within the form itself.
    That means that the value will be updated when users enter new text into
    the memo field.

Hope that helps!

Thanks,
Jessica

··· On Wednesday, May 31, 2017 at 9:10:28 AM UTC, John Harper wrote: > > Jessica or Will ? I have a similar request to do this as well but have not > been able to find the correct set up. > > I have a question list group followed by a repeat group that is a notes > sections.......basically a text field. > > I want to use the join function to do the following. > > join(" > > > ", #form/Task_Details/memo) > > > and use this to give me a line separated text field which i can assign to > my case property.......... > > I have a hidden field right after the repeat group that uses the join as > the default value............this should work.........? > > > > so if my first repeat is "My notes" and my second repeat is "More Notes" > the hidden field should show me > > My notes > More Notes > > Any ideas? > > > > > > > > On Tuesday, August 2, 2016 at 12:36:10 AM UTC-7, Jessica Long wrote: >> >> One additional note. If your repeat count is not fixed, you can still >> save a comma-separated list of all the responses that you've solicited in >> your repeat group. Just create a hidden variable with the following >> calculate condition: >> join(", ", #form/repeat_group/value_to_save) >> >> On Tuesday, August 2, 2016 at 10:40:00 AM UTC+5:30, Jessica Long wrote: >>> >>> I was just working on this myself. Your use case might be different from >>> mine, but I do believe it is possible to save entries of a repeat group as >>> case variables. >>> >>> I did this in a few steps: >>> 1. Create a hidden variable inside the repeat group called repeat_index. >>> I set my calculate condition to: position(..) + 1. This keeps track of what >>> iteration the repeat group is on (I add 1 because the position() function >>> is zero-indexed). >>> >>> 2. I instantiated 5 hidden variables called case_value_1, case_value_2, >>> case_value_3, case_value_4, case_value_5 to capture the variables inside >>> the repeat group that I wanted to keep track of. (My repeat group repeats >>> exactly 5 times. So I know that there will be 5 instances of the variable I >>> want to capture inside the repeat group. If your repeat count is not >>> static, you may need to adapt these instructions.) >>> >>> 3. For each of the hidden variables, I set the calculate condition as >>> follows: >>> case_value_1 = #form/repeat_group/value_to_save[ >>> #form/repeat_group/repeat_index = 1] >>> case_value_2 = #form/repeat_group/value_to_save[ >>> #form/repeat_group/repeat_index = 2] >>> case_value_3 = #form/repeat_group/value_to_save[ >>> #form/repeat_group/repeat_index = 3] >>> case_value_4 = #form/repeat_group/value_to_save[ >>> #form/repeat_group/repeat_index = 4] >>> case_value_5 = #form/repeat_group/value_to_save[ >>> #form/repeat_group/repeat_index = 5] >>> By selecting the value within the repeat_group with a specific >>> repeat_index, I am able to capture each of the values I want in separate >>> hidden variables. >>> >>> 4. Now that you have extracted the case_values from the repeat group, it >>> is easy to save case_value_* as case variables in the case management >>> section of your form. >>> >>> I hope that helps! Let me know if you have any questions, and check out >>> this page on repeat groups for more documentation: >>> https://confluence.dimagi.com/display/commcarepublic/Using+Repeat+Groups+in+the+Form+Builder >>> >>> Thanks, >>> Jessica >>> >>> On Sunday, July 31, 2016 at 11:20:15 AM UTC+5:30, Sam Phiri wrote: >>>> >>>> Hi All, >>>> >>>> Can you save the entries of a repeat group as case properties? I know >>>> you can use these to create child cases but I was wondering if it was >>>> possible to save these to the parent case? >>>> >>>> Kind regards, >>>> >>>

Well as weird as it is looks it did work......

I placed a calculated field outside the repeat group with the calculation
formula as

join("

", task )

i tried ascii char(13) to no avail..........but this did work.

··· On Monday, June 5, 2017 at 9:06:09 AM UTC-7, Jessica Long wrote: > > Hi John, > > A couple of issues stand out to me: > > 1. It's not clear to me how to create a newline-separated list in > CommCare. Newlines are usually special characters that can't be represented > just by typing RETURN in between two quotation marks. I would try using a > space separator (join(" ", #form/Task_Details/memo)) to see if that gives > you some version of what you want, and then separately think about how to > add the newlines. > > 2. You should be entering this calculation into the *Calculate Value* rather > than the *Default Value *of your hidden variable. > - *Default Values *are static, and only calculated once when the form > opens. If you assign join(" ", #form/Task_Details/memo) to a default > value, it will always be blank (the value it had before the form was filled > out). > - *Calculate Values *are calculated dynamically within the form itself. > That means that the value will be updated when users enter new text into > the memo field. > > Hope that helps! > > Thanks, > Jessica > > On Wednesday, May 31, 2017 at 9:10:28 AM UTC, John Harper wrote: >> >> Jessica or Will ? I have a similar request to do this as well but have >> not been able to find the correct set up. >> >> I have a question list group followed by a repeat group that is a notes >> sections.......basically a text field. >> >> I want to use the join function to do the following. >> >> join(" >> >> >> ", #form/Task_Details/memo) >> >> >> and use this to give me a line separated text field which i can assign to >> my case property.......... >> >> I have a hidden field right after the repeat group that uses the join as >> the default value............this should work.........? >> >> >> >> so if my first repeat is "My notes" and my second repeat is "More Notes" >> the hidden field should show me >> >> My notes >> More Notes >> >> Any ideas? >> >> >> >> >> >> >> >> On Tuesday, August 2, 2016 at 12:36:10 AM UTC-7, Jessica Long wrote: >>> >>> One additional note. If your repeat count is not fixed, you can still >>> save a comma-separated list of all the responses that you've solicited in >>> your repeat group. Just create a hidden variable with the following >>> calculate condition: >>> join(", ", #form/repeat_group/value_to_save) >>> >>> On Tuesday, August 2, 2016 at 10:40:00 AM UTC+5:30, Jessica Long wrote: >>>> >>>> I was just working on this myself. Your use case might be different >>>> from mine, but I do believe it is possible to save entries of a repeat >>>> group as case variables. >>>> >>>> I did this in a few steps: >>>> 1. Create a hidden variable inside the repeat group called >>>> repeat_index. I set my calculate condition to: position(..) + 1. This keeps >>>> track of what iteration the repeat group is on (I add 1 because the >>>> position() function is zero-indexed). >>>> >>>> 2. I instantiated 5 hidden variables called case_value_1, case_value_2, >>>> case_value_3, case_value_4, case_value_5 to capture the variables inside >>>> the repeat group that I wanted to keep track of. (My repeat group repeats >>>> exactly 5 times. So I know that there will be 5 instances of the variable I >>>> want to capture inside the repeat group. If your repeat count is not >>>> static, you may need to adapt these instructions.) >>>> >>>> 3. For each of the hidden variables, I set the calculate condition as >>>> follows: >>>> case_value_1 = #form/repeat_group/value_to_save[ >>>> #form/repeat_group/repeat_index = 1] >>>> case_value_2 = #form/repeat_group/value_to_save[ >>>> #form/repeat_group/repeat_index = 2] >>>> case_value_3 = #form/repeat_group/value_to_save[ >>>> #form/repeat_group/repeat_index = 3] >>>> case_value_4 = #form/repeat_group/value_to_save[ >>>> #form/repeat_group/repeat_index = 4] >>>> case_value_5 = #form/repeat_group/value_to_save[ >>>> #form/repeat_group/repeat_index = 5] >>>> By selecting the value within the repeat_group with a specific >>>> repeat_index, I am able to capture each of the values I want in separate >>>> hidden variables. >>>> >>>> 4. Now that you have extracted the case_values from the repeat group, >>>> it is easy to save case_value_* as case variables in the case management >>>> section of your form. >>>> >>>> I hope that helps! Let me know if you have any questions, and check out >>>> this page on repeat groups for more documentation: >>>> https://confluence.dimagi.com/display/commcarepublic/Using+Repeat+Groups+in+the+Form+Builder >>>> >>>> Thanks, >>>> Jessica >>>> >>>> On Sunday, July 31, 2016 at 11:20:15 AM UTC+5:30, Sam Phiri wrote: >>>>> >>>>> Hi All, >>>>> >>>>> Can you save the entries of a repeat group as case properties? I know >>>>> you can use these to create child cases but I was wondering if it was >>>>> possible to save these to the parent case? >>>>> >>>>> Kind regards, >>>>> >>>>