Hi, is it possible to reference a given iteration from a repeat in a report?
I have a repeat ${fw_pump_test}, which includes the question ${fp_name}. There are three iterations of this repeat input into the form. I would like to reference only the second instance of ${fp_name} in a sentence in a report.
I have tried:
${#fw_pump_test | resultRecordCount:2} ${fp_name} ${/}
But this pulls through both the first and second instances. Is there a way to get just the second response?
Thank you.
Hi GusC
You can capture the 2nd value (indexed-repeat(${fp_name}, ${fw_pump_test}, 2) on a hidden question and pull that on the report.
@JoseBarrios1has already provided the correct way of doing this within the Survey itself.
As for the Feature Report, that is expected behaviour for resultRecordCount. It pulls all records up to the specified record. In other words, that is the total number of records to print.
To get just the specified record to show, you can use the where function. Should look something like:
${#fw_pump_test | where:"fw_pump_test_index='2'"} ${fp_name} ${/}
To use "where" in this case, you would still need an indexed repeat, which means updating the survey. I don't think there is a way to get repeat count into the where clause... that said, there is a dedicated function to display which repeat index you are on (not really helpful in this case though):
${$feature | getValue: "position"}
If you want to add an index to your repeat, add a calculate with position(..) to your repeat: