Avatar

Correct answer by
Level 10

Hi,

Looking at the form again, I think this is what you are after:

if(AmountNet > 0) then
    $ = AmountNet + VAT
elseif ((AmountNet  == null or AmountNet == 0) and ExchangeRate > 0) then
    $ = AmountForeign / ExchangeRate
endif

In the previous version the test was "when AmountNet == 0"; however this didn't check if the field was empty. The code above in red checks AmountNet for two conditions: if the field is empty OR if the user has put in £0.00. If either of these is true then the first part of the test is satisfied. The script then moves on to look at the value of the ExchangeRate separately.

Hope that helps,

Niall

View solution in original post