Hello peeps,
I have a question about a calc element I have in my fabrik app.
It calculates the final result of a number from different elements (that are also numbers).
I have it as an ajax calculation in my form so it shows on the go the result. I have written in the format string (%01.2f ?) so whenever I save the form, it shows me on the list a number with 2 decimals and the euro symbol.
My request here is... when the element gives me the result on the form itself, it shows me xxxx,xxxxx , in other words, it shows me a lot of decimals I am not interested to see, I want it to give me the number only with 2 decimals in the form, so I see it before I save it correctly. What should I add to the formula I wrote before, on the return part, to see the result only wiht 2 decimals?
Thanks!
I have a question about a calc element I have in my fabrik app.
It calculates the final result of a number from different elements (that are also numbers).
PHP:
$num1 = (int) '{j32db_scitech___Word_Count_Result_1}';
$num2 = (float) '{j32db_scitech___Type_raw}';
$num3 = (int) '{j32db_scitech___Word_Count_Result_2}';
$num4 = (float) '{j32db_scitech___Type_2_raw}';
$num5 = (int) '{j32db_scitech___Word_Count_Result_3}';
$num6 = (float) '{j32db_scitech___Type_3_raw}';
$num7 = (int) '{j32db_scitech___Word_Count_Result_4}';
$num8 = (float) '{j32db_scitech___Type_4_raw}';
return ($num1 / 1000) * ($num2 * 742.35) + ($num3 / 1000) * ($num4 * 742.35) + ($num5 / 1000) * ($num6 * 742.35) + ($num7 / 1000) * ($num8 * 742.35);
I have it as an ajax calculation in my form so it shows on the go the result. I have written in the format string (%01.2f ?) so whenever I save the form, it shows me on the list a number with 2 decimals and the euro symbol.
My request here is... when the element gives me the result on the form itself, it shows me xxxx,xxxxx , in other words, it shows me a lot of decimals I am not interested to see, I want it to give me the number only with 2 decimals in the form, so I see it before I save it correctly. What should I add to the formula I wrote before, on the return part, to see the result only wiht 2 decimals?
Thanks!