Return negative number as 0
-
Hi, first time posting so hopefully doing it correctly. I have used a form builder to build my forms but have run into a couple of issues with functionality. In the code/calculation below I need to be able to return the answer 0 if the answer is less than 0. I've searched loads to no avail so any help would be much appreciated. T.I.A.
$('form#Commission #Commission_On').formCalc(" Nett_Earnings -Actual_Takings >0==0",{ currency_format:true, mirror:'sfm_Commission_On_parsed'});
-
Hi, first time posting so hopefully doing it correctly. I have used a form builder to build my forms but have run into a couple of issues with functionality. In the code/calculation below I need to be able to return the answer 0 if the answer is less than 0. I've searched loads to no avail so any help would be much appreciated. T.I.A.
$('form#Commission #Commission_On').formCalc(" Nett_Earnings -Actual_Takings >0==0",{ currency_format:true, mirror:'sfm_Commission_On_parsed'});
-
What language is that, it does not look much like Java? However assuming it is supposed to convert that string into an actual sum it does not look valid. In the expression
Nett_Earnings -Actual_Takings >0==0
, what is>0==0
supposed to mean? -
What language is that, it does not look much like Java? However assuming it is supposed to convert that string into an actual sum it does not look valid. In the expression
Nett_Earnings -Actual_Takings >0==0
, what is>0==0
supposed to mean? -
Thanks for answering, I just assumed it was Java as all the scripts are. >0==0 is just one of the ways I was trying to make it work from their info before they told me the form couldn't do the calculation.
-
What is this code and where did you get it from? As I said it does not look anything like Java.
Thanks for answering. The programme is called simfatic form maker. This was their reply to my query "Simfatic Forms calculation field can't handle multiple levels of variables. In this case, the user enters a variable that intern is a variable in the next step. This form has to be hand coded with the help of a developer" Here is the actual form I am trying to make work https://www.salonlogic.co.uk/forms/Commission/Commission.php[^]
-
Thanks for answering. The programme is called simfatic form maker. This was their reply to my query "Simfatic Forms calculation field can't handle multiple levels of variables. In this case, the user enters a variable that intern is a variable in the next step. This form has to be hand coded with the help of a developer" Here is the actual form I am trying to make work https://www.salonlogic.co.uk/forms/Commission/Commission.php[^]
-
I have also tried it this way
$('form#Commission #Commission_On').formCalc(" Nett_Earnings -Actual_Takings >0?0",{ currency_format:true, mirror:'sfm_Commission_On_parsed'});
however that then means no output to the box at all.
That is not Java; that is JavaScript. Despite the similar names, they are two completely different languages. There is a specific forum for JavaScript questions: JavaScript Discussion Boards[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
That is not Java; that is JavaScript. Despite the similar names, they are two completely different languages. There is a specific forum for JavaScript questions: JavaScript Discussion Boards[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Thanks for answering, I just assumed it was Java as all the scripts are. >0==0 is just one of the ways I was trying to make it work from their info before they told me the form couldn't do the calculation.