Our users log into ArcGIS Online (AGOL) and Esri’s mobile apps with enterprise credentials. Our AGOL username is automatically created from our email address and a tag at the end. Like this:
Firstname.Lastname@xyz.com_xyz
In Survey123, the AGOL username of the person who logs into the app and submits a completed form can be calculated using the "property('username')" formula. I would like to have the AGOL username populated in my Survey123 form as input to a question, line like - “Inspected By”.
In Survey123 Connect, how do I parse the AGOL username calculated by "property('username')" into a readable name?
Firstname.Lastname@xyz.com_xyz --> Firstname Lastname
Thank you.
I think the pulldata() function may do the trick for you.
Ismael:
Thank you for your response. I see that I have made a mistake in my original question, which crossed between Survey123 Connect and Report Template building in MS-Word.
I am working in Survey123 Connect and attempting to use the “property('username')” in the calculation field to populate the Inspected By: slot of my survey form. The property('username') comes into my form line as expected from our enterprise login username.
I would like to format this calculation to be “Joe Flannery” (Firstname-space-Lastname).
I am trying to understand MS-Excel formulas for this task just to get my head wrapped about the concept and have gotten as far as using this to parse out the name:
=PROPER(LEFT(E5,FIND("@",E5)-1))
At this point, I’m not even sure that I can use an Excel formula like the one above in the Survey123 XLSform.
Thank you for your patience as I define my need.
Joe
This gets me pretty darn close!
Since all of our Survey123 users have an enterprise login with their corporate email address, they all have the same 12 characters after their name. Here, all I do is keep the text that precedes the last 12 characters to their AGOL user name, albeit, with a dot between first and last name.
Hi Joe, I know this is an old post and most likely you've resolved how to do this for your needs.
But I thought I'd post how I'm doing this using the answer Ismael provided above.
Create a csv file containing 2 columns (name - username) and save this to the media folder of your survey.
In this example the csv is saved as ServicePerson.csv in the media folder of a survey called Water Unit Job Details.
In your survey in Survey123 Connect add a row with a calculation like this.
pulldata('ServicePerson','name','username',property('username')
What this does is...(I find it easiest to read the calculation from right to left)
Well done, Michael!
Thank you for the follow-up response. I'll give this a try.
Joe
Does property('username') work when the person taking the survey is not signed in to Survey123?
It will allow collection of data while not signed in and I've found that the 'username' field type will not record the username when not signed in (makes sense, I guess). It does not add the username when the user signs in to submit the survey.
Please see my reply to your other post here: https://community.esri.com/thread/226878-survey123-username-field-is-null
Phil.
property('username') returns the signed in username, if the user is not signed in then no value will be returned.
In surveys where I want to ensure submitted info is from signed in users I'll add all survey question into a group then use a relevant expression on the begin group line to only show if the user is signed in.
If the user isn't signed in they'll see the note asking them to sign in, at this point the user can still submit the survey but it will be empty.
If I want to ensure empty surveys cannot be submitted then I move the SERVICE_PERSON row (in my example) to the top, and make it a required field (normally make it hidden too).
This is a reasonable solution in some cases, and I have considered doing something similar to this.
However, a lot of our users will be out of network access while collecting data. Therefore signing in after commencing survey collection may not be possible (or at least not until after they've returned to the office, which would require them to double-handle the data).