Gday there,
Im setting up a form to assess groundcover at multiple sites across multiple reserves.
Im currently using a javascript function to create unique lists for concatenated text but I cant figure out a way to Sum an area field for unique Area values (ie I only want to sum the area for a reserve once, no matter how many points are associated with the reserve)
Is there a way that I can add a flag/trigger within the repeat whether the assessment point is the first entry for a reserve, so that I can use this as a filter for building the unique lists and sum fields in the parent table? I feel this should be possible using js but no amount of googling has found an example so far.
Form Structure looks like:
Repeat
- Assessment Location (geopoint)
- pulldata() for reserve attributes (Name, Area, Id etc)
- Assessment fields
- ?? Flag for unique values??
Summary (Parent)
- List of Unique Reserve Names (done)
- Sum of Unique Reserve Area
- List of Unique Reserve ID's (done)
Many thanks.
mw
Solved! Go to Solution.
I'm probably missing something, but why not use a nested repeat?
E.g.,
The general information is within the first (parent) repeat, and the dynamic information is within the second (nested) repeat. This is typically how you'd collect data with common fields, and allows for very easy transformation. However, like I previously mentioned, I may be missing something in the workflow here.
FYI, Managed a solution within js.
unique.js (adapted from https://community.esri.com/t5/arcgis-survey123-questions/challenge-question-looking-for-a-way-to-dis...)
SumArray.js
Is this all within a single survey? If so, "area" should be in a parent table, and your "point data" in a nested repeat. That way the "area" is only collected once per location.
Thanks for the reply @abureaux
Yes, its a single survey,
The Parent level is a summary of the sites assessed in the repeat.
- The repeats use pulldata() to pull in reserve details where the assessment is done (1:m). An expected result might be 30-50 assessment points carried out across 6 reserves to assess groundcover condition.
Desired outcome
Ive got 2 ideas on how to achieve this
Within the repeat - flag the first time a reserve is identified via the pulldata(@layer). Binary True/False
Where flag = True, Use a Sum If query to Sum the area (Is it possible to do an If(,Sum(),)query from the child at the parent level?
I could get the staff to do two repeats (1 to select reserves and 1 to conduct assessments but it is overkill when I can use the pulldata() functionality.
thanks
mw
I'm probably missing something, but why not use a nested repeat?
E.g.,
The general information is within the first (parent) repeat, and the dynamic information is within the second (nested) repeat. This is typically how you'd collect data with common fields, and allows for very easy transformation. However, like I previously mentioned, I may be missing something in the workflow here.
@abureaux , thankyou, I think this is the most logical process to follow.
I was really hopeful for a .js sum unique array or something similar but I totally get the simplicity in the structure of the nested repeats.
I really appreciate your feedback.
mw
FYI, Managed a solution within js.
unique.js (adapted from https://community.esri.com/t5/arcgis-survey123-questions/challenge-question-looking-for-a-way-to-dis...)
SumArray.js