SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: cfif

  1. #1
    SitePoint Addict AshleyH's Avatar
    Join Date
    Mar 2005
    Posts
    260
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    cfif

    I'm a bit stuck on this:

    Code:
    <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:

    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!

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,215
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    what you have looks okay... what kind of problems are you having with it?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Guru downtroden's Avatar
    Join Date
    Dec 2004
    Location
    illinois
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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'.
    your brain reacts in the same way whether you are
    looking at something or thinking about it...

  4. #4
    SitePoint Zealot
    Join Date
    May 2005
    Location
    Suwanee GA
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •