Cfif

I’m a bit stuck on this:


<cfif  (rsCompanyDetails.usr_billcountry eq 'UK') OR (rsCompanyDetails.usr_vatexemptionform NEQ '')>

<cfset session.final_price = session.total_cost + session.shipexchange + session.handlingcharge>
<cfset session.total_vat = session.final_price * 17.5 / 100>
 <cfset session.ordertotal = session.final_price + session.total_vat >

<cfelse>
<cfset session.final_price = session.total_cost + session.shipexchange  + session.handlingcharge>
<cfset session.ordertotal = session.total_cost + session.shipexchange + session.handlingcharge>
</cfif>

What I want it to do is if there is something in the ‘usr_vatexemptionform’ field I need it to perform the following code:

<cfset session.final_price = session.total_cost + session.shipexchange  + session.handlingcharge>
<cfset session.ordertotal = session.total_cost + session.shipexchange + session.handlingcharge>

The ‘usr_vatexemptionform’ will only be filled in by people from the ‘UK’ though…

Any help here would be appreciated!

what you have looks okay… what kind of problems are you having with it?

Your code looks right, but what you’re saying your code is backwards. The two lines you’re wanting to fire will only fire if there’s ISN’T anything defined or it DOESN’T equal ‘UK’.

it may that the NEQ statement is not truly empty but contains a space.
OR (rsCompanyDetails.usr_vatexemptionform NEQ ‘’)

Try adding trim.
OR (trim(rsCompanyDetails.usr_vatexemptionform) NEQ ‘’)

You could also use len to determin if greater than zero.