Select to view content in your preferred language

How to avoid duplicate entries from a feature service and a repeat related table inSurvey123?

540
5
09-11-2023 12:15 PM
JoseBarrios1
Occasional Contributor III

Hello everyone, 

I created a form to capture bird nesting information and I am having an issue with duplicate entries and the parent global ID. The form basically create a nest record when a new nest is found (nest profile) and it creates an observation record on a related table to create a monitoring log for 30 days (see pic below). The problem is that collecting an observation ( the repeat related table) for an existing record also creates a new entry on the feature service with a different globalID and a child with a another parent global ID. I do have a common nest_Id fied that I can use to link the tables in PRO but I still have the problem of many empty records on the feature service. Does anyone have a suggestion on how to address the problem? Thanks for any suggestions!

JB

 

Untitled-1-[Recovered].png

 

0 Kudos
5 Replies
Vinzafy
Occasional Contributor

Hey there!

I can't say for sure as I haven't tried a workflow to edit related records like the one described above, but my best guess as to why you're getting new entries in your hosted feature layer when selecting "Update existing nest record" is because you're launching from S123 directly.

My understanding is that every time a survey is launched directly from S123, it creates a new record as it's a new instance of the survey. My guess is that in your XLSXform, when selecting "Update Existing Record" there's some kind of pulldata() function based on selected zone to populate that choice list. However, even though "Update Existing" was selected, as the survey was launched in S123, a new instance by default was created before the selection to "Update existing" was even chosen, resulting in a new entry.

The way that I've dealt with editing related records is by launching the survey from a URL (either via Field Maps or a Dashboard) in edit mode where the globalid of the desired feature is appended to the URL. Thus, a new instance of the survey isn't launched (which means no new record), and only the specific related record you want to edit will be active.

An example of that could be in field maps. The parent spatial feature will be shown and when that feature is selected, the popup shows all related nest records as clickable URLs where each URL has the corresponding globalid of the nest appended to it. When selecting the URL for the desired nest, S123 is opened in edit mode (thus a new entry isn't created) and all existing nest details are populated.

I'm not sure if that's exactly how it'd work for you, but hopefully that gives some ideas!

Some resources below:

Survey123 Tricks of the Trade: Web form URL parameters 

Survey123 Tricks of the Trade: Editing records in a web form 

Understanding Survey123's custom URL Scheme 

Survey123 Tricks of the Trade: Encode URL parameters in the web app 

JoseBarrios1
Occasional Contributor III

Hello Vinzafy,

Thank you very much for your feedback and suggestions. You are absolutely right regarding the survey123 creating a new instance every time the form is submitted. I can fix that by deleting the "blank" entry using notebook but the problem is that the "updated record' on the related table is getting a "new globalID"  and not the ID  from the first time the record was created. I can pull the previous parentglobalID but I don't know how i can assign that to be the related key for the relationship. I was wondering if there is anyway to assign the parentglobalID manually. I'm trying to avoid field maps because the team is using mobile and desktop to enter the data and also I don't want them to have to install  and maintain two apps. Thanks once again for the great info and the links!

 

JB

0 Kudos
Vinzafy
Occasional Contributor

Hmm I don't think I fully understand the new record in related table creation.


...the "updated record' on the related table is getting a "new globalID" and not the ID from the first time the record was created.

Apologies, but this is the part that I'm getting a bit confused at. Is the existing nest not being edited, but its attributes are being passed to a new record with a new GUID but with fields populated by the existing nest?

Regardless, I fully agree with you that it's tricky to have to maintain two apps which can get a bit confusing! One solution I have been using is to have team members launch the survey via a dashboard.

When they're editing records, they're always on desktop so what I've done is embedded the survey within the dashboard and have it so that it only triggers when a related record is selected from a list. Once that record is selected, the embedded survey opens with a custom URL that has editing parameters so that the existing record is updated.

Another option (probably more feasible for your use case) would be to have a URL dynamically generate when a related record is selected from a list that triggers Survey123 to open in edit mode for that specific record using the GUID parameter.

It still is two separate locations as opposed to one, but at least it's just a dashboard in a browser as opposed to a second app. Now the issues here are that you need to be online for this to work which may not be possible for your use case. With Field Maps, you can take maps offline which would resolve this, but again, would require a second app and corresponding training for field folks.

Anyways, not sure if that idea is something you could use, but hopefully it helps with brainstorming!

Example Screenshots:

Vinzafy_1-1694533883877.png

Vinzafy_3-1694534124387.png

 

0 Kudos
JoseBarrios1
Occasional Contributor III

Sorry for the confusion. It is even hard to explain for me!

Here are the requirements for the survey:

Biologists want to streamline the process for collecting information on nesting birds. The information include: nest location, species, nest description, environmental parameters and daily observation on nesting activity. I created a form that have two actions:

  1. User creates a NEW RECORD (feature layer) when a nest is found (nest ID, location, species, nest decryption, photo and env. parameters). It also create the 1st day observation (on a repeat table) on the nest condition (observer, # of eggs, photo, behavior, etc..)
  2.  The second action is to UPDATE A RECORD (daily obs). When the user select the “update record” , I use the search appearance to populate a list of existing nest records within the selected zone and I pass the nest_ID to relate the tables. The user then collect the observation data for the second day…. They will end with approx. 35 observation for each nest ID.

Here is the problem with current workflow. The first time the user create a NEW nest record, survey123 creates a globalid and a parentglobalid to relate the feature layer with the repeat table. However, when the user select the option to “Update Record”, the new created observation on the repeated table get a new parentglobalid that does not match the globalID from the selected nest profile. The 2nd observation  get the parentglobalid using the globalid from the new blank feature layer record. Does this make sense???

Vinzafy
Occasional Contributor

Ahhh I got you now and understand where the discrepancy is coming from. Thanks for detailing that out further.

Unfortunately I'm not sure how to accomplish that workflow solely within S123 without using URL parameters in some format. Apologies I couldn't help further, but I wish you the best of luck!

If there is a way to achieve that workflow and have it be self-contained in S123, that'd be great info to know.

0 Kudos