Hey all,
The ultimate goal I have is to be able to, at the end of the form, display a list of species details that have been captured in a couple of fields in a repeat called 'Species'. This would be awesome for the ecologists to be able to see in one section everything they have captured instead of having to flick through all the records in the repeat.
I have used the code below in the calculation field and it works great for displaying 1 field like 'species name' but I have been finding it difficult to display additional fields.
join("\n", ${Species_Name})
It would also be great to be able to number each item in the displayed list so that the users can see which record the details were captured.
Can anyone help point me in the right direction?
Solved! Go to Solution.
Ok so the responses above helped me get to the answer, not sure if it was the most efficient way but it works. What I needed to do to get my head around this was to realise that the easiest way was to build the combined species detail summary for each record in the repeat and then join those at the end.
So inside the repeat i have a 'hidden' type (set it to 'note' while i was testing to see if the error was here) and 'species_string' as the name. The calculation ended up looking like the following:
concat(concat(once(count(${Species_Name})), ": ", ${Species_Name}, ": ", ${Behaviour}))
Then outside the repeat I had the 'note' type with the following calculation:
join("\n", ${species_string})
This resulted in the following:
Worked out perfectly. Should have reached out earlier as I was really struggling getting anywhere with this for a while.
Thanks for your help legends!!!
Something like join("\n", concat(once(count(${Species_Name})), " ",${Species_Name})) may work
The count shows up but it does not concatenate it to a list and only displays the most recent value as can be scene circled in red below.
Whenever I try to concatenate in a join, this is the problem i run into.
A hidden field inside the repeat using the concat() function and the the join() function outside the repeat.
concat(${Question}, ': ', ${Species}}
If you want to take it a step further and have nested repeats, say they can enter multiple species. Species would be in repeat 2 and Question and Habitat would be in repeat 1.
concat(${Question}, "(",${Habitat},"):", join(", ",${Species}))
You can try <br> in place of \n in the join() if you are using the form on the web. I think <br> works for both while \n only works in connect/field app?
join("<br>, ${SpeciesName})
Keep in mind character limits and I find it is a good idea to null the calculation fields and summary especially if there is a chance the calc will exceed the limit. This will cause a crash at submission, I don't think character limits are enforced on calc fields. (bind:: esri:fieldType = null)
This was very helpful and pointed me down the right path.
I will make sure null the calcs and check entering long summaries to make sure all is ok.
I set a note question and in its calculation column used join('<br>', ${Species_Name}) and it worked. If you put the join('<br>', ${Species_Name}) in the label column it doesn't like the join formula being there.
Ok so the responses above helped me get to the answer, not sure if it was the most efficient way but it works. What I needed to do to get my head around this was to realise that the easiest way was to build the combined species detail summary for each record in the repeat and then join those at the end.
So inside the repeat i have a 'hidden' type (set it to 'note' while i was testing to see if the error was here) and 'species_string' as the name. The calculation ended up looking like the following:
concat(concat(once(count(${Species_Name})), ": ", ${Species_Name}, ": ", ${Behaviour}))
Then outside the repeat I had the 'note' type with the following calculation:
join("\n", ${species_string})
This resulted in the following:
Worked out perfectly. Should have reached out earlier as I was really struggling getting anywhere with this for a while.
Thanks for your help legends!!!