Constant Sum - add leading zero to resulting sum, if sum < 10 | XM Community
Skip to main content

Hi everyone!
I would like to display and save the result (i.e., the sum) of a constant sum question in a way that always two digits are displayed/saved. I already added a range requirement (0-99).
But for sums < 9, a leading zero should be added. For example: If the resulting sum is 8, it should be displayed (also in piped text) and saved as "08" not as "8".
Is there a way to do this? Thank you for your help.
Best

Hi there,
I think this can be accomplished via the survey flow and branch logic. Have the respondent answer the Constant Sum and then save the total as embedded data in the Survey Flow. Then, if that total value is less than or equal to 9, add a 0 to the beginning of it, like in the below:
ConstantSum_2digit.png


Leave a Reply