Copy link to clipboard
Copied
I'm missing something again as this isn't working either 😞
The first part - if "vat rate.10" says Exempt then "vat value.10" will show 0 - works great, but I can't get the next bit to work. If "vat rate.10" contains a value (any percentage), then "vat value.10" should show "aVATRate.10 x "net value.10"
if (this.getField("vat rate.10").value == "Exempt") {
event.value = 0;
}
else {"aVATRate.10"*"net value.10";
}
Use this code:
if (this.getField("vat rate.10").value == "Exempt") {
event.value = 0;
} else {
event.value = Number(this.getField("aVATRate.10").valueAsString) * Number(this.getField("net value.10").valueAsString);
}
Copy link to clipboard
Copied
To access field values you must use:
this.getField(" field name ").value
Copy link to clipboard
Copied
So where would that bit go in my poor attempt in the original question?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I tried following the earlier one:
if (this.getField("vat rate.10").value == "Exempt") {
event.value = 0;
}
else {
event.value = this.getField("vat rate.10").value = "aVATRate.10" * "net value.10";
}
but the following appears
Vat value.10 is formated as a number with 2 decimal places
Copy link to clipboard
Copied
Hi,
Check the field properties , under the Format tab for the "vat rate.10" field , it should be set to none.
Copy link to clipboard
Copied
Use this code:
if (this.getField("vat rate.10").value == "Exempt") {
event.value = 0;
} else {
event.value = Number(this.getField("aVATRate.10").valueAsString) * Number(this.getField("net value.10").valueAsString);
}
Copy link to clipboard
Copied
Perfect!!!! Thank you Try 67, much appreicated 🙂