CalcBuilder Forum

Simple Calculation!!!!!!!!

User moon_677 2012-08-29 15:11:38

I have what I thought was going to be a simple calculation but can't work out how to include it in to Calc Builder. As I said it is simple and I am sure that the answer is simple.

I want a visitor to be able to enter a value (no decimal) - No problem create a field

I then want to take that value and divide it by a constant (85,000) = A

I then want to round the result up to the next whole number (I would add .99 and then drop anything after the decimal point) = B

I also need to divide the result 'A' by a constant of 2 and then round it up to the next whole number.

The result are to be displayed in a column fashion (I think I have this sussed)

Calc one = Round down((amount/85,000)+.99)
Calc two = Round down(((amount/85,000)/2)+.99)

Moonsoft support 2012-08-29 22:06:53

Hello,

in order to make the calculation work, you have to follow php sintax. Just add a $ sign before the variables/fields name and a ; at the end of each line. When using numbers in calculations (85000), avoid using decimal and thousand separators.
Also note you have available a function to do the rounding-up, the information is here:

http://php.net/manual/en/function.ceil.php

, so your line would be like this (assuming the user input field is called 'amount'):


$result1 = ceil($amount/85000);

and then you can go to the output layout and write ##result1## to show it as the first result, with the layout needed.


We suggest to download and check the example calculator 'first steps' to have an overview of the workflow to get and show the results.

Hope this helps,

User moon_677 2012-09-04 16:11:34

Thanks very much, working fine. Now just need to get a second calculation to work.

...
CalcBuilder

Create dynamic calculators

Buy now!
...
Support/development 40 hours

With the peace of mind of having a professional team at your service (20% discount)

Buy now!