Rounding up in calculations

Does OpenClinica provide a way of rounding calculations to a specific number of decimal points?

My calculations for BMI etc are shown to about 10 decimal places. The clinical team have let me know that this is less than convenient for them. WIDTH_DECIMAL only seem to apply to data being entered.

I'm not hopeful I'd rather not have to use JavaScript if I can help it, but if there's no alternative, it'll have to do. I'm not massively hopeful because it seem OC lacks such mathematical basics as MOD and INT.

Many thanks.


Answers

  • lkeitalkeita Posts: 50
    via Email
    Hi there,

    In the WIDTH_DECIMAL cell for BMI, enter w(2) - this rounds it to 2 decimal
    places. The w means "I don't care how wide the result is, and the (2)
    means...but...round it to 2 decimal places. If you want to control the
    width, replace the w with the total width, and be sure to count the decimal
    as one of those spaces. For example, to allow for 999.99, WIDTH_DECIMAL
    should be 6(2).

    I hope this helps!

    Best regards,

    *Laura*

    *Laura Keita *|* OpenClinica, LLC*
    Director of Training and Compliance
    Direct: *+1.781.547.8462*
    [email protected] | www.openclinica.com

  • Malcolm HartMalcolm Hart Posts: 7
    Hi Laura

    Thank you for that. However, I was under the impression that this only applies to data that is being entered by a user, and is not available for the formatting of the result of calculations performed by OpenClinica. The error message that I got seemed to imply that, anyway. Am I incorrect?

    All the best

    Malcolm
  • lkeitalkeita Posts: 50
    via Email
    Hi Malcolm,

    It works for me:

    [image: image.png]

    What is the error message?

    Best regards,

    *Laura*

    *Laura Keita *|* OpenClinica, LLC*
    Director of Training and Compliance
    Direct: *+1.781.547.8462*
    [email protected] | www.openclinica.com

  • Malcolm HartMalcolm Hart Posts: 7
    Hi Laura

    Well I feel like an idiot now. I went to check the error message and couldn't reproduce it. All I got were perfectly-rounded-to-one-decimal-place answers to my calculations.

    If I can recall, correctly, the error was a long piece of text that appeared when loading the CRF .xls which explained the w(2) syntax, but then said something like 'this method can't be used in calculation fields'. Anyway, clearly I misread it, because it all works for me now.

    Many thanks, Laura

    Malcolm
  • lkeitalkeita Posts: 50
    via Email
    You're welcome! Glad it works!

    Best regards,

    *Laura*

    *Laura Keita *|* OpenClinica, LLC*
    Director of Training and Compliance
    Direct: *+1.781.547.8462*
    [email protected] | www.openclinica.com

Sign In or Register to comment.