Cannot get my math operation to round

uhrxx005uhrxx005 Community Member Guru ✭✭

Cannot get my math operation to round

I have a math formula within an ED field that I am trying to round to 3 decimal places. Here is how I have it currently setup:

$e{ round( q://QID106%231/SelectedAnswerRecode/1 * 2.24146232) / ( q://QID10/ChoiceTextEntryValue * .49 ) - (.017 * q://QID106%232/SelectedAnswerRecode/1 , 3 ) }

The formula is calculating correctly and I am not receiving any error message, but it also is not rounding at all. Does anyone know how to fix this?

Thanks!

Best Answers

  • JenCXJenCX Broomfield, CO Superuser ✭✭✭✭
    edited July 11 Accepted Answer

    Try this:

    $e{ round(( q://QID106%231/SelectedAnswerRecode/1 * 2.24146232) / ( q://QID10/ChoiceTextEntryValue * .49 ) - (.017 * q://QID106%232/SelectedAnswerRecode/1 , 3 ) }

    If that doesn't work, I would guess it's getting confused with the nesting and would recommend you save that formula as its own embedded data field and then use round on that ED.

  • TomGTomG Raleigh, NC Wizard ✭✭✭✭✭
    edited July 12 Accepted Answer

    Try this:

    $e{ round ( ( q://QID106%231/SelectedAnswerRecode/1 * 2.24146232 ) / ( q://QID10/ChoiceTextEntryValue * 0.49 ) - (  0.017 * q://QID106%232/SelectedAnswerRecode/1 ) , 3 ) }
    

Answers

  • uhrxx005uhrxx005 Community Member Guru ✭✭

    It didn't work. I'll try creating separate variables. Thanks.

  • AkdashboardAkdashboard South CarolinaCommunity Member, Product Ideas Superuser ✭✭✭✭

    Try this - I think your order of operations were off.

    $e{ round( (q://QID106%231/SelectedAnswerRecode/1 * 2.24146232) / (( q://QID10/ChoiceTextEntryValue * .49 ) - (.017 * q://QID106%232/SelectedAnswerRecode/1 , 3 ))) }

    I think your last statement |"- (.017 * q://QID106%232/SelectedAnswerRecode/1 , 3 )"| was being applied after the rounding.

  • uhrxx005uhrxx005 Community Member Guru ✭✭

    @Akdashboard, it still didn't work. That's okay though. Thank you for looking into it.

  • uhrxx005uhrxx005 Community Member Guru ✭✭

    @tomG got it to work!

  • AkdashboardAkdashboard South CarolinaCommunity Member, Product Ideas Superuser ✭✭✭✭

    woot woot! Go @TomG! TomG is the man!
    (I've had coffee this morning).

Sign In to Comment