-
1. Re: Only calculate if "Variable" is present
try67 May 6, 2014 3:02 PM (in response to Chaye28)What should happen if the value of the field is neither blank, nor bigger than 1 (for example, 0.5)?
-
2. Re: Only calculate if "Variable" is present
Chaye28 May 6, 2014 4:54 PM (in response to try67)I didn't think about that but that but yes it would have to calculate anything that is not zero or blank.
-
3. Re: Only calculate if "Variable" is present
try67 May 7, 2014 12:47 AM (in response to Chaye28)You can use something like this:
var v = this.getField("DraftTempPost").value;
if (v=="") event.value = "";
else event.value = (Number(v)/40)-2.75;
-
4. Re: Only calculate if "Variable" is present
Chaye28 May 7, 2014 1:59 PM (in response to try67)I know i am missing some language to go along with your script (thank you btw for taking the time with this). I pasted your script and it does nothing, nor does it give me any errors.
Should there be language behind it, something like this?
Function (((....
than the equation?
-
5. Re: Only calculate if "Variable" is present
try67 May 7, 2014 2:11 PM (in response to Chaye28)Open the JS Console (Ctrl+J) and check for errors. What exactly happens when you change the value of the DraftTempPost field?
-
6. Re: Only calculate if "Variable" is present
Chaye28 May 7, 2014 2:51 PM (in response to try67)I have been staring at a computer for far to long and failed to see that the input "DraftTempPost" needed to be changed to "DraftTempPre" It was all operator error on my part.
thank you very much for your help.
-
7. Re: Only calculate if "Variable" is present
GKaiseril May 7, 2014 4:50 PM (in response to Chaye28)I assume you are placing this script in the field where the result of the calculation is to appear.
Sine you want to control the display, you need to use a conditional statement and that can only be done in the Custom JavaScript calculation option. You will need to write the JavaScript code and link to the field and event objects.
event.value = (this.getField("DraftTempPost").value / 40) - 2.75;



