Calculation App doesn't seem to want to subtract numbers

Comments

4 comments

  • Rainer Grabowski

    Hi Steve,

    you mix up text and numbers. So you have to separate text and numbers.

    You can wrap the number calculation in additional brackets:

    "$ " + ((@Field1 * @Percentage) - (@Field2 + @Field3))

    or let the number calculation run in a variable:

    var sum =  (@Field1 * @Percentage) - (@Field2 + @Field3);
    "$" + sum

    Rainer

    0
    Comment actions Permalink
  • Michelle

    Ranier, as usual your reply worked perfectly. Many thanks.

    If I could ask one further question - the result is showing as a number without the correct formatting ($5000). Is there a method to add further to the calculation field so that the formatting is correct, and / or changing the amount of decimal places included in the result?

    I'd like to see something like:  $5,000, $10,000, or $5,000.00 etc.

    Thanks for your continued response.

    0
    Comment actions Permalink
  • Rainer Grabowski

    Hi Steve,

    this should format the number as you want is: 

    var sum =  (@Field1 * @Percentage) - (@Field2 + @Field3);
    var sum = sum.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
    "$" + sum

    Rainer

    0
    Comment actions Permalink
  • Michelle

    Rainer,

    Many thanks, I'll give it a go shortly.

    Appreciate your help once again.

     

    Have a great day!

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk