Create a census survey

Create a survey

You can author a survey with either the ArcGIS Survey123 web app or the ArcGIS Survey123 Connect desktop app. You'll use the desktop app, which uses Microsoft Excel as its authoring environment and has more options for customization and advanced functionality.

  1. Open ArcGIS Survey123 Connect.
    Note:

    Note: If you don't have ArcGIS Survey123 Connect, you can download it from the Survey123 product page. Under Survey123 Connect desktop app, download the installer for the appropriate operating system. Run the installer and follow its steps to install the program.

  2. Click New survey.

    New survey button

    The New Survey window appears. You'll name your survey and choose the initial design of the survey's XLSForm. An XLSForm is a type of form standard that simplifies the creation of forms, such as Survey123 surveys, in Microsoft Excel.

    You have the option to choose an XLSForm design from several locations, including the Survey123 community, your ArcGIS organization, a feature service, or an XLSForm file saved on your computer. You'll use a default template design.

  3. For Title, type Zambia Short Form and add your name or initials to ensure the name is unique.
  4. For Select an initial XLSForm design, confirm that Advanced Template is selected.

    Title and XLSForm design parameters for a new survey

  5. Click Create survey.

    The survey is created and displayed in Survey123 Connect. By default, it contains two example questions.

    Default survey with example questions

    Additionally, Microsoft Excel opens with the survey's XLSForm.

    Default XLSForm with example questions

    Note:

    Depending on your version of Microsoft Excel, your form may differ in appearance from the example images.

    In the form, a row contains information about a single question. Information about the first question is on row 2, while information about the second question is on row 4.

    Columns contain different types of information. Column A contains each question's type, column B contains each question's name, and column C contains each question's label.

    The type column determines how users answer the question. The first question has a text type, so users answer by typing a line of text. The second question has a select_one yes_no type, so users answer by selecting either yes or no. (The choices for these types of questions are determined by a list in a different tab of the XLSForm.)

    The name column contains the question's name, which does not appear in the survey and must be unique for each question. The label column contains the text that appears in the survey.

    There are also optional columns for adding advanced functionality. This lesson will cover some of these columns as you add questions.

    You don't need the example questions, so you'll delete them.

  6. Highlight the first three columns of rows 2 through 4.

    Highlighted example survey questions

  7. Press the Delete key.

    The questions are deleted.

  8. At the bottom of the XLSForm, click the choices tab.

    Choices tab

    The choices sheet appears.

    Default choices sheet

    This sheet contains lists of choices for questions with the select_one type or a similar type. One of the example questions used the select_one yes_no type. The yes_no part refers to the yes_no list in this sheet, which has two choices (yes and no).

    In this sheet, each row contains a choice, while each column contains information about the choice. The list_name column groups choices with the same name. The name and label columns work the same as the previous sheet.

    You'll keep the yes_no list because many questions use yes or no as possible answers. You don't need the rating list, so you'll delete it.

  9. Highlight the first three columns of rows 5 through 9 and press Delete.

Add an integer question

You've created a survey and deleted the example questions. Next, you'll add the first question of your census survey, which will ask users how many people reside in their households.

  1. In the XLSForm, click the survey tab.

    Survey tab

    You return to the sheet for adding questions. First, you'll choose the question type. This question is asking how many people live in a household, so the answer should be a number. You'll choose the integer type.

  2. Click cell A2 to select it. Click the drop-down arrow and choose integer.

    Integer option for type column

    Note:

    For a full list and description of the question types, click the Question types tab at the bottom of the XLSForm.

    Next, you'll give the question a name. Names must not use spaces. If you're using ArcGIS Enterprise, they must not use capitalization either.

  3. In cell B2, type num_residents.

    Name column with the num_residents name

    You'll also add a descriptive label that asks the question in a clear way.

  4. In cell C2, type How many people are usual residents of this household?

    Label column with the question's label

    Your question has the three components necessary for a functioning question: type, name, and label. You'll also add a hint that provides additional context or clarification. People frequently move or live in multiple locations for work, school, or other reasons, so the definition of a usual resident may be unclear. A hint may help census enumerators receive more accurate answers.

  5. In cell D2, type Include anyone who spent more than 50 percent of the last year living here.

    Hint column with a hint for more clarification

  6. Click the Save button.

    Save button

    Tip:

    You can also save the XLSForm by pressing Ctrl+S.

    The form is saved. Saving the form updates Survey123 Connect, so you can see how the question looks in the survey.

  7. If necessary, bring Survey123 Connect to the front of the screen.

    Survey with one question

    The question is displayed. Because this question uses the integer type, only numbers can be typed in the text box. If a user tries to type letters or other characters, they will not appear.

Add a geopoint question

Your survey will also ask for the household's geographic location. You could create a text question that asks for an address, but instead you'll create a geopoint question, which prompts users to choose a location on a map.

Survey123 surveys collect survey responses using feature services hosted on ArcGIS Online. These feature services can be added to web maps as layers. With a geopoint question, this survey's feature service will have spatial data that can be mapped and analyzed without any need for conversion.

  1. In the XLSForm, for cell A3, choose geopoint.

    Geopoint option for type column

  2. For cell B3, type building_loc. For cell C3, type Select the building location on the map.

    Completed geopoint question

  3. Save the XLSForm.

    In Survey123 Connect, the question is displayed.

    Survey with geopoint question

    Note:

    If you receive an error that reads Position source closed error, you may not have location services enabled on your device. If you turn on location services, the error should go away. Additionally, the default extent of your map is based on your location and may differ from the example images.

    Users can click or tap the map to set their building location.

Add name and gender questions

Next, you'll add questions that ask for the name and gender of the person being interviewed for the survey. The name question will use the text type, which allows the user to type a line of text.

  1. In the XLSForm, in cell A4, choose text.
  2. In cell B4, type resident_name. In cell C4, type Enter resident's name.

    Question asking for the resident's name

    The next question will ask for the gender of the person being interviewed. Users will choose one gender from a list of options, so you'll use the select_one type. Using defined lists instead of open text fields makes filling in the survey easier. It also ensures consistency in the data and reduces the chance of spelling errors or other mistakes.

  3. In cell A5, choose select_one list_name.

    You need to replace the list_name text with the name of the list of choices on the choices tab. There's no list of gender choices, so you'll make one.

  4. At the bottom of the XLSForm, click the choices tab.

    Your list of gender choices will include three options: male, female, and other. First, you'll set the list name for these choices.

  5. In cells A5, A6, and A7, type gender.

    Gender list name

    Next, you'll add the names and labels of the choices.

  6. Enter the following information:
    • In cell B5, type male, and in cell C5, type Male.
    • In cell B6, type female, and in cell C6, type Female.
    • In cell B7, type other, and in cell C7, type Other.
    Note:

    Remember to pay attention to capitalization. Capital letters are not recommended in question or choice names.

    Choices for the gender list

    With the list of choices created, you can finish creating the survey question.

  7. At the bottom of the XLSForm, click the survey tab.

    First, you'll replace the placeholder list_name text in the type column with the name of your list of gender choices.

  8. In cell A5, replace list_name with gender.

    Type column set to select_one gender

  9. In cell B5, type gender.

    For this question's label, you want to make it clear whose gender is being asked for. When filling in a census survey for multiple people in a household, it can be difficult to make sure information about the correct person is going into the correct field.

    To avoid this problem, you'll include a special notation in the label so that the name of the person being interviewed is included in the question. In the previous question (resident_name), the person being interviewed provided their name. By putting the name of a question inside special formatting, you can include that question's answer as text in a subsequent question.

  10. In cell C5, type What is ${resident_name}'s gender?

    Gender question with all information filled in

  11. Save the XLSForm. In Survey123 Connect, for the Enter resident's name question, type your name and press Enter.

    Name and gender questions in the survey

    When you answer the name question, your answer is automatically added to the text of the gender question. This way, there is no ambiguity about who is being asked to provide their gender.

Calculate age

The next question will ask for the resident's birthday. It'll use the date question type, which prompts the user to choose a date from a calendar. You'll use the responses to that question to calculate the resident's age and report that age back to the person collecting the survey.

  1. In the XLSForm, in cell A6, choose date.
  2. In cell B6, type birthday. In cell C6, type When was ${resident_name} born?

    Birthday question added to the form

    To calculate the resident's age based on their birthday, you'll create a question with the calculate type. However, you won't give this question a label, because it isn't a question that the user will answer in the survey. The calculation will be done in the background, saving enumerators time.

  3. In cell A7, choose calculate. In cell B7, type age.

    Calculate question added to the form

    Next, you'll add the formula for the calculation. Column K of the XLSForm is the calculation column, which is where you'll type the formula using the XForms/XPath formula language.

    Your formula will take the current date, subtract the resident's birth date, and divide the result by the number of days in the year (365) to calculate age in years. You'll also round the result to the nearest whole number, because people rarely express their age using decimals.

  4. If necessary, scroll to column K. In cell K7, type the following formula:

    round(((decimal-date-time(today())-decimal-date-time(${birthday})) div 365),0)

    Formula to calculate age in the calculation column

    Like when you called the answer to the resident_name question using the ${resident_name} notation, the ${birthday} part of the formula calls the answer to the birthday question.

    You'll add a question with the note type to report the age to the person taking the survey. The note type takes no inputs and only displays the label text.

  5. In cell A8, choose note. In cell B8, type report_age, and in cell C8, type ${resident_name} is ${age} years old.

    Note question to report the resident's age added to the form

    Feature services created by surveys include the responses to each question in the feature service's table. The note question doesn't collect any new data and is only intended to be viewed by the census enumerator filling in the survey. You'll add functionality so the note question does not appear as a field in the feature service.

  6. Scroll to column T.

    Column T is the bind::esri:fieldType column. If you choose null for this column, a field for this question will not be added to the feature service's attribute table.

  7. In cell T8, choose null.

    Null added to the bind::esri:fieldType column

  8. Save the XLSForm.
    Note:

    Depending on your device, it may take a few moments for the survey to update after you save it.

  9. In Survey123 Connect, answer the resident name and resident birthday questions.

    Birthday and age questions in the survey

    The survey now calculates an age based on the birthday entered.

Add a head of household question

You'll add a final question that asks whether a resident is the head of household. You'll use advanced functionality to make this question only appear if a resident is at least 18 years old, because this question is only relevant to adults.

  1. In the XLSForm, in cell A9, choose select_one list_name. Replace list_name with yes_no.

    The yes_no choices list was in the default form template, so you don't need to create it.

  2. In cell B9, type head_of_household. In cell C9, type Is ${resident_name} the head of household?

    Head of household question added to the form

    Next, you'll make sure this question only appears if the resident's age is greater than or equal to 18. The relevant column (N) is where you can add information about when a question is relevant and should appear.

  3. Scroll to column N. In cell N9, type ${age}>=18.

    Relevant column with formula added

  4. Save the XLSForm.
  5. In Survey123 Connect, submit answers for the name and birth date questions. For the birth date question, choose a date from over 18 years ago.

    The head of household question appears once a birth date over 18 years ago is chosen.

    Head of household question in the survey

Add a repeat

The questions you've added to collect name, gender, age, and head of household information only apply to one person, but census enumerators generally want to collect information about all members of a household and keep that information together in a single geographic location. Rather than create a new survey or copy and paste the questions you've created, you'll set up a repeat.

A repeat designates a series of questions to be repeated. A repeat must be added to the XLSForm in the row before the question or questions you want repeated. You'll insert a new row before the resident_name question.

  1. Right-click row 4 and choose Insert.

    Insert option

    A blank row is added between the geopoint question and the resident name question. Starting with the resident name question, the questions are moved down one row.

  2. In cell A4, choose begin repeat. In cell B4, type resident_qs.

    Repeat questions have labels. On the survey, they appear at the top of the group of questions being repeated, similar to a heading.

  3. In cell C4, type Individual Questions.

    Begin repeat question added to the form

    Next, you'll indicate where the repeat ends.

  4. In cell A11, choose end repeat.

    End repeat question added to the form

    The end of the repeat doesn't need a name or label.

    You can set a specific number of times the questions will be repeated or allow the user to repeat the questions as many times as they want. Because you already asked how many people live in the household, you'll use the answer to that question as the number of times to repeat the questions.

    You set the number of times to repeat in the repeat_count column (P) of the begin repeat row.

  5. Scroll to column P. In cell P4, type ${num_residents}.

    Number of times to repeat set to the number of residents question

  6. Save the XLSForm.
  7. In Survey123 Connect, answer the first question (the number of residents question) and confirm that the name, gender, and birth date questions are repeated a corresponding number of times.

Change settings and publish the survey

You've finished adding questions to your survey. Your survey is now a basic census form that enumerators can use to collect key information from households. Before you publish the survey, you'll change some of its settings.

  1. In Survey123 Connect, under the survey preview, click Options.

    Options button

    The Options tab includes several settings that may be useful for your survey. You'll adjust a setting to require users of the survey to update to the survey's latest version. This way, you can ensure enumerators are using the same survey even if you update the survey after you publish it.

  2. Turn on Require update to the latest version of this survey.

    Require update to the latest version of this survey option

  3. Click Map.

    Map button

    On this tab, you can set the home extent and basemap of the map in the geopoint question. By default, the map will navigate to the user's location, if their device has GPS enabled. Not all devices are enabled in such a way, so setting a default extent is helpful. That way, enumerators can return to a set location when they click the Home button.

  4. For Detailed map, navigate the map to the extent of Zambia.
    Tip:

    If you have difficulty locating Zambia, you can enter the following parameters: Set Zoom level to 5.28, set Latitude to -13.201938, and set Longitude to 28.010905.

    Map extent set to Zambia

  5. Click Form to return to the form preview.

    Next, you'll set the title of the survey form.

  6. In the XLSForm, click the settings tab.

    Settings tab

    The default form title is Survey title not set.

  7. In cell A2, delete the default title and type Zambia Census Short Form.

    Form title changed to Zambia Census Short Form

  8. Save the XLSForm.

    In Survey123 Connect, the form title is displayed at the top of the form.

    Title shown on the form

  9. Click Details.

    Details button

    On this tab, you can set metadata for your survey. You can add a thumbnail, summary, and description. You can also change the title. This information is shown to enumerators when they access the survey on their device.

  10. For Summary, type A census form to collect basic information in Zambia. For Description, type This survey contains basic census questions for Zambian households. Using this form, enumerators can collect information about the number of residents and each resident's name, gender, and age.

    Summary and Description fields filled in with proper metadata

    There are other settings you can change, but for now, your survey is complete. You'll sign in to your ArcGIS account and publish the survey so census enumerators can access it on their mobile devices.

  11. Click Publish.

    Publish button

    If you're not already signed in, a window appears prompting you to do so.

  12. Sign in to your ArcGIS organizational account.
    Note:

    If you don't have an organizational account, you can sign up for an ArcGIS free trial.

    After you sign in, a window appears telling you that changing a survey after it is published may require changes to the corresponding feature service.

  13. Click Publish survey.

    After a few moments, the survey is published. A feature service is created in your ArcGIS Online account to contain the information collected using the survey.

  14. When the publishing is complete, click OK.

    Once a survey is published, it can be downloaded by members of your organization to their computers or mobile devices using the ArcGIS Survey123 field app.

    Note:

    To confirm that the survey can be downloaded using the field app, you can install the field app on your computer or mobile device and test the survey. Go to the Survey123 product page. Under ArcGIS Survey123 field app, click the download link for your computer or device's operating system. Run the downloaded installer and follow its instructions to install the field app. Open the field app, sign in, and click Download surveys. Search for the survey you created and click the download button to download it. Once the survey is downloaded, you can use it to collect information in the field.

  15. Close Survey123 Connect and the XLSForm.

In this lesson, you created a basic census survey using Survey123 Connect. There is a lot of advanced functionality in Survey123 that this lesson didn't cover. You can learn about the full range of capabilities in the Survey123 documentation.

The survey you created not only collects important census information, it has a spatial component that can be mapped and analyzed using spatial data science. Geography is increasingly acknowledged as key to virtually all national statistics systems, providing a structure for collecting, processing, aggregating, managing, analyzing, sharing, and disseminating data. National statistics offices have an opportunity when conducting a census to capture geospatial information about the people of their country, data that can be used to support internal projects and global initiatives such as the United Nations Sustainable Development Goals.

You can find more lessons in the Learn ArcGIS Lesson Gallery.