Can you round scoring calculations in embedded data? | XM Community
Question

Can you round scoring calculations in embedded data?

  • 14 November 2023
  • 6 replies
  • 66 views

Userlevel 1
Badge +4

Hi All, 

 

I am adding some embedded data to calculate the percentage of a score. I use the following for the value of the embedded data field with the piped text in that calculation being the piped text for the scoring:

$e{ ( gr://SC_emoKcRxLvqHeFTw/Score / 3 ) * 100 } 

Is there anything I can add here, so the results would be rounded when included in my report? I saw some folks discussing some things in the developer forums, but it was not quite in this context.  

Thanks in advance for any guidance you have. 


6 replies

Userlevel 7
Badge +27

@MargaretW,

You can do this:

$e{ round( ( gr://SC_emoKcRxLvqHeFTw/Score / 3 ) * 100 ) , 0 ) } 

Userlevel 1
Badge +4

Tom! thank you. For future knowledge, I am assuming the 0 before the closing parenthesis refers to the number of places after the decimal. Is that correct? Thanks again. 

Userlevel 7
Badge +27

Tom! thank you. For future knowledge, I am assuming the 0 before the closing parenthesis refers to the number of places after the decimal. Is that correct? Thanks again. 

Correct.

Badge +1

@TomG I attempted the method you shared, but I am receiving {Invalid Expression}. Would you mind looking at this and letting me know if you see anything wrong with it? Thank you!

 

$e{ round( ( WHODAS_mean ) , 2 ) }

Userlevel 7
Badge +27

@TomG I attempted the method you shared, but I am receiving {Invalid Expression}. Would you mind looking at this and letting me know if you see anything wrong with it? Thank you!

 

$e{ round( ( WHODAS_mean ) , 2 ) }

Is WHODAS_mean an embedded data field? Is so it would be:

$e{ round( e://Field/WHODAS_mean , 2 ) }

Badge +1

@TomG I attempted the method you shared, but I am receiving {Invalid Expression}. Would you mind looking at this and letting me know if you see anything wrong with it? Thank you!

 

$e{ round( ( WHODAS_mean ) , 2 ) }

Is WHODAS_mean an embedded data field? Is so it would be:

$e{ round( e://Field/WHODAS_mean , 2 ) }

 

@TomG Yes, it was an embedded data field. That fixed it!

 

Thank you so much for your prompt problem-solving! I really appreciate it.

Leave a Reply