Round up to nearest $5 in InfoPath 2007 - Rush!! - InfoPath Dev
in

InfoPath Dev

Round up to nearest $5 in InfoPath 2007 - Rush!!

Last post 02-25-2011 11:16 AM by Hilary Stoupa. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 02-25-2011 07:11 AM

    Round up to nearest $5 in InfoPath 2007 - Rush!!

    I am creating a form and in one field I already have a function/calcualtion that includes other fields  ((field16 * 1.15) + field20) * field25

    I need this calculation to round up to the nearest $5.  How do I need to write this formula to get that result??

  • 02-25-2011 08:33 AM In reply to

    Re: Round up to nearest $5 in InfoPath 2007 - Rush!!

    ceil(value div 5) * 5

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 02-25-2011 09:20 AM In reply to

    Re: Round up to nearest $5 in InfoPath 2007 - Rush!!

    Do I put this before or after the the fist equation?  Sorry, VERY new to infopath!

  • 02-25-2011 09:22 AM In reply to

    Re: Round up to nearest $5 in InfoPath 2007 - Rush!!

    like this?  ceil((field16  * 1.15) +field20 ) *field25div 5) * 5

    I get an error like this.

  • 02-25-2011 09:36 AM In reply to

    Re: Round up to nearest $5 in InfoPath 2007 - Rush!!

    Heres what I got to work

     ceiling((((field16 * 1.15) + field20) * field25) / 5) * 5

     

  • 02-25-2011 10:58 AM In reply to

    Re: Round up to nearest $5 in InfoPath 2007 - Rush!!

    I get this error:

     The expression is not a node-set.
    ceiling(-->(((field16*1.15)+field20)*field25)<--/5)*5

  • 02-25-2011 11:04 AM In reply to

    Re: Round up to nearest $5 in InfoPath 2007 - Rush!!

    Make sure you have a space before and after the "/" symbol (or type in div as per Jimmy's example, again with space before and after).

    Hilary Stoupa

  • 02-25-2011 11:08 AM In reply to

    Re: Round up to nearest $5 in InfoPath 2007 - Rush!!

    Awesome, it works!!!

  • 02-25-2011 11:16 AM In reply to

    Re: Round up to nearest $5 in InfoPath 2007 - Rush!!

    Wonderful.

    A little unsolicited advice -- if this form is not in production (that is, no one has started using it yet) you should consider re-naming your fields. Formulas, conditional formatting, rules -- they are all so much easier to deal with when your fields have names like "Quantity" and "Price" instead of field12345. And, if you put this form in production like this and need to make a change in 6 months, you'll make yourself batty trying to remember what field25 is.

    Also, so you know for the future, that error message was basically saying "I think you are telling me about a field you'd like me to select, and I can't find it". Everything between the --> and the <-- was what it was trying to evaluate. That's how I knew (aside from looking at the text you'd pasted) what the error was, since we use "/" in our XPath to select a field...

    Hilary Stoupa

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