Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Date Range Search

    I have a calendar search from where an option is to search between dates and
    riight now it never finds anything. Do I need to do a format conversion? or
    do I need to do something to the CFOUTPUT to get it to work? Any idea. thanks.
    (MSACCESS db)

    <cfapplication SESSIONMANAGEMENT = "Yes">
    <cfif session.marker_find EQ 1>
    <cfset session.marker_find = 0>
    <cfif IsDefined("Form.description")>
    <CFSET SESSION.Cf_description = FORM.description>
    <cfelse>
    <CFSET SESSION.Cf_description = " ">
    </cfif>
    <cfif IsDefined("Form.category")>
    <CFSET SESSION.Cf_category = FORM.category>
    <cfelse>
    <CFSET SESSION.Cf_category = " ">
    </cfif>
    <cfif IsDefined("Form.months")>
    <CFSET SESSION.Cf_month = FORM.months>
    <cfelse>
    <CFSET SESSION.Cf_month = " ">
    </CFIF>
    <CFIF IsDefined("Form.fromdate")>
    <CFSET SESSION.CF_fromdate = FORM.fromdate>
    <CFELSE>
    <CFSET SESSION.Cf_fromdate = "">
    </cfif>
    <CFIF IsDefined("Form.todate")>
    <CFSET SESSION.CF_todate = FORM.todate>
    <CFELSE>
    <CFSET SESSION.Cf_todate = "">
    </cfif>
    </cfif>
    <CFQUERY NAME="calendarresult" DATASOURCE="source">
    SELECT *
    FROM event_cal
    WHERE public=yes
    <!---search by Description--->
    <CFIF #SESSION.Cf_description# GT " ">
    AND title LIKE '%#SESSION.Cf_description#%'
    </CFIF>
    <!---search by Category--->
    <CFIF #SESSION.Cf_category# GT " ">
    AND category = '#SESSION.Cf_category#'
    </CFIF>
    <!--- search by Month--->
    <CFIF #SESSION.Cf_month# GT " ">
    AND event_date LIKE '#SESSION.Cf_month#%'
    </CFIF>
    <!---search by Date Range--->
    <CFIF #SESSION.Cf_fromdate# GT " " AND #SESSION.Cf_todate# GT " ">
    AND event_date BETWEEN '#SESSION.Cf_fromdate#' AND '#SESSION.Cf_todate#'
    </CFIF>
    ORDER BY event_date
    </CFQUERY>

    TheScarecrow Guest

  2. Similar Questions and Discussions

    1. Date Range Validation
      Hello; CL_FRST (08/10/2004) and CL_LST (05/24/2005) holds the beginning and ending date of school calendar which is also prepopulated for every...
    2. Date Range
      I?ve got a routine that figure out 30 days from today?s date, but what I want to do is resolve a start date and an end date where the start date is...
    3. Newbie can't get date range search from form to work
      Please help! I'm banging my head against a wall here. This is my first stab at ASP. I'm able to pass vars from a form to a search results page...
    4. Functional index in 9.30 not used for range search
      Gabor Heppes wrote: I can't say that I've solved it, but it may be that the default cost of using the functional index is too high. If you...
    5. date range query
      Hi I just need to pull up a query which will bring up orders between a specified date range say jan 2003/ july 2002 and from this I have to pull up...
  3. #2

    Default Re: Date Range Search

    if your cf_month is eq MM and your event_date is eq to DD/MM/YY they will never equal
    try this cf_month = #DatePart("m", event_date)#

    jorgepino Guest

  4. #3

    Default Re: Date Range Search

    The month and date range search are seperate.
    TheScarecrow Guest

  5. #4

    Default Re: Date Range Search

    AND event_date BETWEEN #createODBCDate(SESSION.Cf_fromdate)# AND #createODBCDate(SESSION.Cf_todate)#

    tjfrevert 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