Constant Sum and Piped Text - validation error | XM Community
Skip to main content

Hello,

I am hoping to get help with a constant sum question error.

I am using piped text as default choice in my constant sum question statements and I have made one a negative (so I added a “-”). I am basically looking to subtract expenses from Income (both answered in prior questions) automatically for the user. 

The calculation and piped text work perfect but when I go to proceed in survey I get a “Please enter valid number” error message due to the piped text. 

Is there custom code to ignore the validation for a constant sum question? I have no validation on. 

Any help would be greatly appreciated, I am not familiar with coding and JS.

thank you!!

Hi @CPalme ,

This would not be feasible using above method as your Piped data is static and Total sum is a dynamic in nature.
You can use JS for real time subtraction .
Or if you want to avoid using JS, you can pipe this  value in the next page  and use below mathematical operation for the result :

 $e{ q://QID15/TotalSum - q://QID16/TotalSum}

If you need to store this , then you can use embedded data in the survey flow to store the same.

Hope this resolves your query😊!!


@CPalme,

Your approach works for me.  So:

  1. Make sure “Add range requirement” is off. 
  2. Make sure your piped data is numeric (no spaces, commas, currency symbols, etc.). Also, make sure your negative symbol is correct (e.g., not a long dash, etc.)
  3. Make sure your default choices are numeric (no trailing spaces after your piped values, etc.)

Thank you both so much for the help!!

I followed your approach @TomG  and it worked, I just had to change my piped text so it wasn’t coming from multiple fields. 


Leave a Reply