Constant Sum | XM Community
Skip to main content

Constant Sum

  • February 13, 2023
  • 5 replies
  • 18 views

Forum|alt.badge.img

image.pngMy total must be between 0 and 100.
What code should I add?

5 replies

jmborzick
QPN Level 5 ●●●●●
Forum|alt.badge.img+41
  • QPN Level 5 ●●●●●
  • 249 replies
  • February 13, 2023

Forum|alt.badge.img

I appreciate the effort but I'm far from being a Java expert so I need a more specific explanation.
The code is great but it doesn't accomplish what I need as it has variables that I am unsure how to identify in my project. Thanks !


qualtrics_nerd
Level 5 ●●●●●
Forum|alt.badge.img+19
  • Level 5 ●●●●●
  • 225 replies
  • February 14, 2023

Hi know_nothing ,
You don't need to code anything.
You can use inbuilt feature of Qualtrics for it, known as "Range requirements" in validation section.
image.pngThere you can set any range value as per your requirement.
For checking total sum to be 100 you can put validation "must total" be 100.
image.pngimage.png
Hope it resolves your query😊!!!


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5938 replies
  • February 14, 2023

Range requirement applies to the individual inputs, not the total.
JavaScript isn't needed.
Use custom validation with an arithmetic expression. For example, if the QID of your constant sum question was QIDx and you had three rows (not including Total):
If Choice1 Is Less Than or Equal to $e{ 100 - q://QIDx/ChoiceNumericEntryValue/2 - q://QIDx/ChoiceNumericEntryValue/3 }


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5938 replies
  • February 14, 2023

Duplicate post deleted


Leave a Reply