How to display full state name using embedded data and content validation? | XM Community
Question

How to display full state name using embedded data and content validation?

  • 24 November 2020
  • 2 replies
  • 40 views

Hello,
My survey currently has a form question that asks respondents for their City and State. The state question has the US State validation setting selected.
Screen Shot 2020-11-24 at 1.21.47 PM.pngI store respondents' answers to the state Q as Embedded Data (see the last row):
Screen Shot 2020-11-24 at 1.25.21 PM.png
On the next page, I ask respondents how many years they have lived in their state (using the embedded data labels).
"About how many years have you lived in ${q://QID678/ChoiceTextEntryValue/2}?"
This works fine, but it displays the state exactly as the respondent worded it (e.g., About how many years have you lived in ca?")
My problem: I would like to display the properly capitalized, full name of the state in the second question. So, for example, if the respondent enters "ca", I would like the second question to ask "How long have you lived in California?" (A less ideal but acceptable solution would convert "ca" to "CA".) I also don't want to have to use an external dataset to do this, if possible.
I understand that I can do this if I ask respondents for their zip code (see link), but I don't know how to simply clean up the state abbreviation respondents have already entered.

Any help would be very much appreciated! Thanks.


2 replies

Userlevel 4
Badge +4

I think Qualtrics is using ISO 3166-2 standard for the state names.
Create a javascript object that contains key-value pairs with abbreviations as keys and full names as values. Then simply look up the participant's response in that object. Don't forget to make the lookup case insensitive. If Qualtrics is using that dataset AND you have validation, then, unless the response is blank, you should not have to do any further error handling.

Badge +9

npetrov937 I don't suppse you have resources showing more on how this is done? I have a similar scenario where I need to 'translate' an abbreviation into a full name and this seems like the most plausible solution. I'm afraid I'm not sure how to go about initiating it.
Thanks!
Kate

Leave a Reply