Storing digits from a text response as Embedded Data fields in Qualtrics | Experience Community
Skip to main content
Solved

Storing digits from a text response as Embedded Data fields in Qualtrics

  • January 27, 2026
  • 5 replies
  • 36 views

Forum|alt.badge.img+1

I’m working on a Qualtrics survey where respondents enter an ID number, and I need to use individual digits from that ID to perform a math operation that determines question assignment.

Specifically, the workflow I’m trying to implement is:

  1. Respondent enters an ID (e.g., a 7-digit numeric ID) in a survey question.

  2. Each digit of this ID is stored as a separate numeric Embedded Data field (e.g., digit_1, digit_2, …).

  3. I then perform a math operation on a subset of these digits (e.g., summing digits 6–12 and checking even/odd).

  4. Based on the result, respondents are assigned to different question blocks.

My questions are:

  • What is the recommended way in Qualtrics to reliably store individual digits from a respondent-entered ID as numeric Embedded Data fields?

  • Would using a Form question with one numeric entry box per digit be the preferred approach compared to parsing a single text entry?

Any guidance or examples would be greatly appreciated. Thanks in advance!

Best answer by vgayraud

sumDigits = $e{ e://Field/digit5 + e://Field/digit6 + e://Field/digit7 }
isEven = $e{ e://Field/sumDigits % 2 }

even → isEven = 0

odd → isEven = 1

5 replies

arunxmarchitect
Level 3 ●●●
Forum|alt.badge.img+5

@Bayan ,

The easiest and recommended approach is to either:

  • Use a Form question (or multiple text entry fields) to capture each digit separately, or

  • Use a single text entry question and apply JavaScript to split the entered ID into individual digits and store them in Embedded Data fields.

Once the digits are stored as Embedded Data, you can use Qualtrics’ built-in Math Operations to perform the required arithmetic calculations and drive your survey logic (e.g., even/odd checks, sums, routing, etc.).

Qualtrics Built-in Math Operations

Math operations allow you to create custom values based on each response. For example, you can calculate a formula using scoring or Embedded Data for individual participants. Math operations can be performed in the Survey Flow, within a question, or in choice text.

Documentation:

https://www.qualtrics.com/support/survey-platform/survey-module/editing-questions/piped-text/math-operations/

 

Step 1 - Option (1) Create a Form Question

Use Form → Text Entry with:

  • 7 fields (or however many digits)

  • Set each field to Numeric validation

  • Label them like:

Digit 1 | Digit 2 | Digit 3 | Digit 4 | Digit 5 | Digit 6 | Digit 7

 

Step 2 - Save Each Field to Embedded Data

In Survey Flow, immediately after the question, add:

digit1 = ${q://QIDxx/ChoiceTextEntryValue/1}

digit2 = ${q://QIDxx/ChoiceTextEntryValue/2}

digit3 = ${q://QIDxx/ChoiceTextEntryValue/3}

digit4 = ${q://QIDxx/ChoiceTextEntryValue/4}

digit5 = ${q://QIDxx/ChoiceTextEntryValue/5}

digit6 = ${q://QIDxx/ChoiceTextEntryValue/6}

digit7 = ${q://QIDxx/ChoiceTextEntryValue/7}

These are stored as numbers, not strings.

 

Step 3 - Do Math in Survey Flow

Now you can safely do:

sumDigits = ${e://Field/digit5} + ${e://Field/digit6} + ${e://Field/digit7}

Then:

isEven = ${e://Field/sumDigits} % 2


vgayraud
QPN Level 7 ●●●●●●●
Forum|alt.badge.img+61
  • QPN Level 7 ●●●●●●●
  • January 28, 2026

If you’d rather have a single form field and still not use javascript, you can probably just simulate a floor function in that situation. It should work as long as you don’t have very large IDs.

For example, you could do this to calculate if the sum of the last 4 digits of a number is odd or even (remove line breaks first, added them for readability):

$e{
(
( ( ( q://QID1/ChoiceTextEntryValue/1 / 1000 ) % 10 ) - ( ( ( q://QID1/ChoiceTextEntryValue/1 / 100 ) % 10 ) / 10 ) )
+
( ( ( q://QID1/ChoiceTextEntryValue/1 / 100 ) % 10 ) - ( ( ( q://QID1/ChoiceTextEntryValue/1 / 10 ) % 10 ) / 10 ) )
+
( ( ( q://QID1/ChoiceTextEntryValue/1 / 10 ) % 10 ) - ( ( ( q://QID1/ChoiceTextEntryValue/1 ) % 10 ) / 10 ) )
+
( q://QID1/ChoiceTextEntryValue/1 % 10 )
)
% 2
}

 


arunxmarchitect
Level 3 ●●●
Forum|alt.badge.img+5

@Bayan , you now have the best solutions covered from both ​@vgayraud  and me. Between these approaches, you should be able to implement this reliably in Qualtrics.


Forum|alt.badge.img+1
  • Author
  • January 28, 2026

Thank you so much ​@arunxmarchitect and ​@vgayraud this is helpful!!

I tried both ways and they both worked. 


vgayraud
QPN Level 7 ●●●●●●●
Forum|alt.badge.img+61
  • QPN Level 7 ●●●●●●●
  • Answer
  • January 28, 2026
sumDigits = $e{ e://Field/digit5 + e://Field/digit6 + e://Field/digit7 }
isEven = $e{ e://Field/sumDigits % 2 }

even → isEven = 0

odd → isEven = 1