There is a top depth and a bottom depth in a repeat...Is it possible to copy automatically a bottom depth to a top depth in the next repeat?
Thanks!
Solved! Go to Solution.
You cannot really copy but if you know the fields are in order you can pull it off.
See this post I go it with Gap and with Soil Dept. I thought there were more posts but I can't find them.
Hope that helps
You cannot really copy but if you know the fields are in order you can pull it off.
See this post I go it with Gap and with Soil Dept. I thought there were more posts but I can't find them.
Hope that helps
Thank you Doug Browning! That worked!
I'm trying to solve a similar problem, except I am looking to "carry forward" the value from 'Question 1' into the next repeat 'Question 1'. Any attempts at referencing Question 1 in a calculation for Question 1 result in a Dependency Cycle error - even if the value from the previous Question 1 is stored in a temporary field, and that field is referenced in the calculation. Any insights on a possible work around?
@Vince_ERAC This sounds like what I'm trying to do. Did you ever get this to work?
Unfortunately no.
@DanielWebb and @Vince_ERAC The way I've been able to make this work is by using a simple JavaScript function. The key there is that you can pass the whole repeat to the function and then return the field value you want so you avoid the dependency cycle error. Here's the function:
function previousvalue (repeat, recordnumber, fieldname)
{
if (recordnumber > 1) {
return repeat[recordnumber-2][fieldname];
}
}
And here's an example of the pulldata calculation you would do in a field outside the repeat:
pulldata("@javascript", "functions.js", "previousvalue", ${occupants}, ${current_record}, "occupant_name")
where occupants is the name of the repeat, current_record is a field outside of the repeat that stores the index of the repeat record you are currently on, and occupant_name is the name of the field inside the repeat that you want to carry the value forward for. I attached a demo .xls to help show how to set this up. This used to be slow with big repeats but with the 3.14 update I haven't encountered any issues.
This may be a place for a calculate and field outside the repeat - something like TopDepth outside repeat - inside repeat the TopDepthRepeated question has ${TopDepth} in the calculate column. Could even make the repeated field read only or hidden. This has worked for me in similar situations