AnsweredAssumed Answered

Script to update Table 2 with only unique Table 1 values

Question asked by breeanne on Dec 9, 2016
Latest reply on Dec 9, 2016 by breeanne

So, I have a database for collecting field data.

 

There is an observations table (Table 1 in title) where the field tech creates observation records:

Category, Common Name, Description... etc.

 

There is another table that is a checklist of observed species. I would like the database to be responsive, so as the observations table is populated, those values can be used as a Species value list (Table 2) for the checklist. I would just create a value list directly from the observation table for this, but that would require the field tech to have the entire observations table on the mobile device, and to cut down on file size, I am hoping to just have a Species table that the value list is sourced from. In addition, I'd prefer to have the species contain it's own species_ID, and not the observation_ID for manipulation later.

 

So, I would like to write a script that updates the Species table with the new unique species from the observation table (where multiple entries of the same species will exist). I have the species name as a unique, evaluate always field, but that only seems to work the way I want when importing. With the script, it will just display a warning message and the user has to select No, Revert field, Continue Script, etc. for each duplicate entry. And if I error capture, I just end up with a bunch of blank records.

 

This is the script I have so far:

 

Untitled.jpeg

 

Any suggestions?

 

Thanks!

Outcomes