Select to view content in your preferred language

Pulldata CSV select_one autopopulate and date and time format

402
4
04-22-2024 11:53 AM
JessieBainbridge
New Contributor

Hi there!
I am very new to Survey123. I am not sure if what I want to do is possible, but here it goes. I am doing a series of animal mark-recapture surveys. When an individual is caught, it is given a PIT tag, which is scanned upon recapture, and the returning number is used to identify the individual. In my Survey 123 xlsx, I have created a select_one_from_file file_name.csv to obtain the label value from the csv, which is the PIT tag number (name = tagnumb in Survey123 xlsx). In my CSV I also have the Site_name (the site name of where it was first caught), datefirst (date of first capture), previouslycap (previously captured, yes or no) age first (age at first capture juvenile or adult) and sexfirst (sex at of the individual female, male, and unknown in my CSV. In my Survey123 form, I want name = sex (type = select_one female, male, unknown), name = recap (type = select_one yes or no), and age (type = select_one, juvenile or adult) to autopopulate if the individual has been caught before. If it is a new individual, I want to be able to type in the tag number and select the sex, age, and no for recapture. I also want to be able to change the answers if the individual's sex was misidentified when first captured. I will add more individuals to this CSV file as more have been captured. I attached a screenshout of my Survey 123 xlsx form and CSV to this post. I bolded the calculation under the name = sex. Does anyone by any chance know what I am doing wrong?
Also, I am wanting to format the date to DD-MMM-YYYY and time to 24 hour time and not quite sure how to do that either as this format-date(${date_capture}, '%e, %a, %Y') and this format-date(${time_capture}, '%H:%M') is not working when I create a seperate calculate type and wondering if someone might know why?

Thank you for your time in advance!

4 Replies
abureaux
MVP Frequent Contributor

You wan to use pulldata(). Go here and look for Retrieve a value from CSV.

Here is a general idea of how it looks like in S123 (you can substitute "Text" fields for those calculates in your case):

abureaux_2-1713817730835.png

And a general idea of the CSV (assuming you know how to set that up, but just in case):

abureaux_3-1713817846511.png

 

Also, I am wanting to format the date to DD-MMM-YYYY and time to 24 hour time and not quite sure how to do that either as this format-date(${date_capture}, '%e, %a, %Y') and this format-date(${time_capture}, '%H:%M') is not working when I create a seperate calculate type and wondering if someone might know why?

Everything you should need on Dates/Times is in Dates and Time in Survey123. It looks like you have the correct idea already though. When I try your calculates, they work as expected:

abureaux_0-1713817548658.png

abureaux_1-1713817555454.png

 

0 Kudos
JessieBainbridge
New Contributor

Hi there,

Thank you for your reply!  I have seen the link you provided and I still cannot get it to work.  It does not autopopulate.  My screenshots below. I can't figure out why it's not working.  Also for the date and time, I just want the date and time (24 hrs) and date (DD-MMM-YYYY) to show not create a seperate field in the survey.  Is there a way to do that? Thank you!

Screenshot 2024-04-22 125254.pngScreenshot 2024-04-22 125016.png

0 Kudos
abureaux
MVP Frequent Contributor

Also for the date and time, I just want the date and time (24 hrs) and date (DD-MMM-YYYY) to show not create a seperate field in the survey. Is there a way to do that? Thank you!

Ahhh. So you want the blow questions to display in that format. That is not possible. S123's time settings are unique to the app. E.g., my device is set to 24 hr time and S123 displays 12 hr time.

abureaux_0-1713902445198.png

I have seen the link you provided and I still cannot get it to work. It does not autopopulate. My screenshots below. I can't figure out why it's not working.

You need to change the column headers. "name" and "label" are mandatory column headers (just like on the Choices tab of the Excel document).

abureaux_1-1713902741619.png

Have another look at my example:

abureaux_2-1713902789944.png

 

0 Kudos
VHolubec
Esri Regular Contributor

Hello ,

maybe my view to your workflow is not complete (and the answer below does not answer directly to your question) but I assume have some of the records available right? Those are/aren´t in the feature layer or just in CSV?

If you have your records in CSV, just thinking if you add a new animal with new PIT tag, do you expect that this new values for new animal will add to the CSV for future recapture?

What about to make is in a different way? Since you have some of the captures in table (CSV) - what about to convert this table to Feature layer? On this feature layer you will polish a data model you want use and at best add one more related feature layer for re-occurred capture (in survey it will use repeat section) - and then publish it to AGO.

The main feature layer will be an animal card, where each record with contain a tag name + Info about the animal. In the related table you will store the location and date/time of the capturing the animal.
Then based on this, you will create a survey.

When you will find a new animal you will start to make a new record for animal with new PIT Tag, If you found already marked animal, you will use Inbox for editing existing records, where you can edit the "animal card" + add the recapture information to related feature layer.
Does this makes sense? Or this proposal is out of your needs?

Regarding the time, I am afraid this could be a limit - since the fuctions format-date and format-date-time function allow you to convert date objects into strings (as mentioned here: https://community.esri.com/t5/arcgis-survey123-blog/dates-and-time-in-survey123/ba-p/895528)

Vladimir
0 Kudos