Help with syntax for a mathematical operation with piped text? | Experience Community
Skip to main content
Solved

Help with syntax for a mathematical operation with piped text?

  • Oct 19, 2018 11:29 PM UTC
  • 2 replies
  • 97 views

Hello all, I am attempting to use the following line of syntax: $e{ ( abs(118 - q://QID72/ChoiceTextEntryValue ) + abs(35 - q://QID84/ChoiceTextEntryValue ) + abs(76 - q://QID88/ChoiceTextEntryValue ) + abs(37 - q://QID92/ChoiceTextEntryValue ) + abs(112 - q://QID96/ChoiceTextEntryValue ) + abs(56 - q://QID100/ChoiceTextEntryValue ) ) / 6 } The syntax is supposed to calculate the absolute value for 6 responses subtracted from a preset number, sum these 6 responses, and divide by 6 to provide the mean. The equations to calculate the absolute values are working correctly when tested in isolation, so the issue appears to be related to the fact that I have multiple levels of parentheses. Instead of dividing by 6 at the end, I could also try a mean function if one exists.

Best answer by LaurenK

Hey @AnthonyM! If you have not yet already, I would recommend checking out this page about troubleshooting math operations. Otherwise, feel free to reach out to our Support Team directly, so they can further troubleshoot this with you!
View original

2 replies

PeeyushBansal
Level 7 ●●●●●●●
Forum|alt.badge.img+52
  • Level 7 ●●●●●●●
  • Oct 20, 2018 2:58 AM UTC
Parentheses in above calculation seems correct. If it is creating problem . In first embedded variable calculate sum of your absutes and create other final embedded variable where you decide earlier embedded variable by 6. There is no direct mean function available.

LaurenK
Former XM Community Team Member
Forum|alt.badge.img+13
  • Former XM Community Team Member
  • Answer
  • Oct 25, 2018 7:19 PM UTC
Hey @AnthonyM! If you have not yet already, I would recommend checking out this page about troubleshooting math operations. Otherwise, feel free to reach out to our Support Team directly, so they can further troubleshoot this with you!