Need advice how to use an double field in an text field. - InfoPath Dev
in

InfoPath Dev

Need advice how to use an double field in an text field.

Last post 09-28-2007 12:30 PM by Clay Fox. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 09-28-2007 05:18 AM

    Need advice how to use an double field in an text field.

    Hello,

    I want to display a text about discount in a textfield at the end of an filled out invoice form.
    It should be the following text:
    If you pay within the next 10 days we grant you a discount of 5% (209.23€).
    The bold text -> 209.23 should be taken from a calculated field - invoice_discount - of type double which is configured to be displayed as a number with 2 decimal places.

    When using the formula -> concat("If you pay within the next 10 days we grant you a discount of 5% ("; invoice_discount; "€).")
    It works fine, but the invoice_discount gets displayed with more than 2 decimal places like 209.2300010 ! ARGHH...
    I couldn’t find a suitable solution to display the invoice_discount field with only the 2 desired decimal places in the text field.

    Any suggestions would be great.

     

  • 09-28-2007 12:30 PM In reply to

    Re: Need advice how to use an double field in an text field.

    I would add to your concat formula a substring function to truncate after 2 decimal places.

    concat("If you pay within the next 10 days we grant you a discount of 5% ("; substring-before(invoice_discount, "." ); "."; substring-length(substring-after(invoice_discount, "."), 0, 2); "€).")

    I think that should give you what you need.

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