Compass Travel example search not working

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Compass Travel example search not working

    Hi

    I seem to be having a problem copying the example Compass Travel application
    in the pdf files.

    When I've copied the code to create the first part of the search with the
    tripLocation as the WHERE clause in the query.
    When running the search with selecting the begins with from the select box and
    using C, it brings back absolutely nothing.
    Yet if I run the search selecting is and type in China, it brings back the one
    record like it says in the PDF file.

    It seems as if the query isn't running the wildcard for the begins with
    search, when running through the examples has anyone encountered this problem,
    or know why this is happening?

    Thanks

    Here's my function in the CFC:


    <cffunction name="getTripsFromForm" output="false" access="public"
    returntype="query">
    <!--- Create WHERE clause from data entered via search form --->
    <cfset WhereClause = " 0=0 ">
    <!--- Build subclause for trip location --->
    <cfif Form.tripLocationOperator GT "">
    <cfif Form.tripLocationOperator EQ "EQUALS">
    <cfset WhereClause = WhereClause & " and tripLocation = '" &
    form.tripLocationValue & "'">
    <cfelse>
    <cfset WhereClause = WhereClause & " and tripLocation = '" &
    form.tripLocationValue & "%'">
    </cfif>
    </cfif>
    <cfquery name="TripResult" datasource="CompassTravel">
    SELECT tripID, tripName, tripLocation, departureDate, returnDate, price
    FROM trips
    WHERE #PreserveSingleQuotes(WhereClause)#
    </cfquery>
    <cfreturn TripResult>
    </cffunction>


    KevCB Guest

  2. Similar Questions and Discussions

    1. In search of working IM library
      I provide information via email to several clients, and in many cases it would be better to use an instant messanger like MSN, Yahoo, or AIM. My...
    2. 3 field search not working
      I have a 3 field search http://www.websitemedia.net/demo/7665/without_fl/qualitymotorsdemo.cfm The 3 fields work great individually. But i am...
    3. How to make a 3D compass
      i'm trying to make a 3d compass. the needle will correspond to the movement of the camera. my idea was to get the value of the z axis rotation of...
    4. Compass rose
      Could anybody help me solving the following task: In my project a user can navigate through a 3D landscape scene. I want to design a compass rose...
    5. Help search not working version 4.0
      hi since i reinstalled XP the help search applet is not loading... status bars says "version 4 browser and java required" i have MS java VM...
  3. #2

    Default Re: Compass Travel example search not working

    Doesn't matter now, I missed out the 'Like' in the WHERE clause.

    It should have been:

    <cfset WhereClause = WhereClause & " and tripLocation Like '" & form.tripLocationValue & "%'">
    KevCB Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139