CalcBuilder Forum

incorrect code

User moon_453 2012-04-27 03:20:06

whats wrong here

$ac=$p1*$.1;
$ai=$num1*$ac;
$sum=$a1*$.8;

the only two variable fields are p1 and num1 im trying to have all the math done on the back end and display results when i try this it says something is incorrect.

thanks
dave

Moonsoft support 2012-04-27 09:47:23

Hello,

Your code:

$ac=$p1*$.1;
$ai=$num1*$ac;
$sum=$a1*$.8;

We don´t know exactly what you want but maybe $.1 could throws a syntax error. If you want to multiply just :

$ac=$p1*.1;

or

$ac=$p1*0.1;

$ is used only for variables not if you want to use a number in this case.

Hope this helps. Regards,

Moonsoft Team

User moon_453 2012-04-27 14:57:49

Ok and the $ac there is no created variable for this. I need a result in order to do the next calculation. Do I keep it like this or do I need to create another field?

Thanks

Moonsoft support 2012-04-27 17:09:54

Hello,

That´s ok. You don´t need to create a field with variable ac to use it in Code. In fact, when you write $ac=$a*0.1 you are creating a variable $ac and you can use it in exit layout as ##ac## to see it in result.

Regards,

Moonsoft Team

...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!
...
Support/development 40 hours

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

Buy now!