So I'm tring to create a custom calc script wherein two dropdowns (selection for unit values, e.g. mg/mL vs ug/mL) have their values selected by the user. The user also fills in numbers for other fields. Then calculations using those other fields are performed to return an answer to yet another field.
Here is my sloppy prelim version (I just started learning this java stuff 2 days ago, so please bear with me):
if (this.getField("Dropdown8").value=="mg/mL") && (this.getField(“Dropdown88”).value==”ug/mL”)) event.value = (this.getField("mls8").value*this.getField("useat8").value/this.getField("stock8").value/1000).toFixed(2)
Such that if units for one field are selected as mg/mL and units for the other field are selected as micrograms per mL (ug/mL) then the target field performs that ridiculous calculation and returns it to 2 decimal points.
I just get syntax errors the whole time. Thanks in advance for the help!
Copy link to clipboard
I miss one ( after if.
I added the ( after if and still get syntax error: illegal character 1: at line 2
After removing the second condition (after the &&) the editor accepted the script. It seems as though the && part is what's giving it trouble...
You must use " not “ .