How to truncate a decimal field - InfoPath Dev
in

InfoPath Dev

How to truncate a decimal field

Last post 03-31-2011 11:07 AM by deppen. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 03-30-2011 09:04 AM

    • deppen
    • Not Ranked
    • Joined on 03-30-2011
    • Posts 8

    How to truncate a decimal field

    Hi.  I am using Infopath 2003.  I have a decimal(double) field in a form with one decimal place.  I’m looking for a way to truncate the field instead of having Infopath round the value in the field.  For example, if a user enters 4.899 in the field, the field becomes 4.9.  I want the value of this field to remain 4.8.  Any help you can offer is appreciated.  Thank you!

  • 03-31-2011 10:36 AM In reply to

    Re: How to truncate a decimal field

    Hi deppen. Use this rule on your decimal field:


    If The Expression: contains(string(decimalField), "."):

    Set a field's value: decimalField = number(substring(string(decimalField), 1, string-length(substring-before(string(decimalField), ".")) + 2)).


    Hope this helps!
  • 03-31-2011 11:07 AM In reply to

    • deppen
    • Not Ranked
    • Joined on 03-30-2011
    • Posts 8

    Re: How to truncate a decimal field

    Qwerty, 

    That is just what I needed and it works perfect.

    Thank you for your help!

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.