Professional Web Applications Themes

Recordset Filtering a Form Variable String - Macromedia Dreamweaver

what server model? joe "ID:UK" <webforumsusermacromedia.com> wrote in message news:bejrua$2a4$1forums.macromedia.com... > I have a form which passes a variable onto the next page. The variable is a string (ie. "1,3,23,56,65,77") > > How can I create a recordset query which filters the ID number of the database with this string, only displaying the records corresponding to the numbers in the string? > > Any help would be most appreciated. > > Jamie > >...

  1. #1

    Default Re: Recordset Filtering a Form Variable String

    what server model?

    joe



    "ID:UK" <webforumsusermacromedia.com> wrote in message
    news:bejrua$2a4$1forums.macromedia.com...
    > I have a form which passes a variable onto the next page. The variable is
    a string (ie. "1,3,23,56,65,77")
    >
    > How can I create a recordset query which filters the ID number of the
    database with this string, only displaying the records corresponding to the
    numbers in the string?
    >
    > Any help would be most appreciated.
    >
    > Jamie
    >
    >

    Joe {RoastHorse} Guest

  2. #2

    Default Re: Recordset Filtering a Form Variable String

    Assuming ASP and ADO...

    Dim myArray(1000)
    Dim myString, counter, loc1, loc2, numRecs, filterString
    myString = request.form("IDs")
    counter = 0
    loc 1 = 0
    loc 2 = 0
    while NOT inStr(myString, ",") = -1 then
    loc2 = inStr(myString, ",")
    myArray[counter] = mid(myString, loc1, (loc2 - loc1))
    counter = counter + 1
    loc 1 = loc2
    myString = left(myString, loc1)
    wend

    numRecs = uBound(myArray)
    filterString = "ID = "
    for (i = 0 to numRecs)
    if i = 0 then
    filterString = filterString & myArray
    else
    filterString = filterString & " OR ID = " & myArray
    end if
    next

    Then just use myRS.filter = filterString to filter the records...

    There's no guarantee that'll work, I just typed that off the top of my head!!

    It's a good pointer though..

    MX is like a box of chocolates - Someone's usually eaten the good bits already!
    Flashjunky webforumsuser@macromedia.com Guest

Similar Threads

  1. PHP Recordset Filtering
    By alanmarchman in forum Dreamweaver AppDev
    Replies: 0
    Last Post: May 17th, 08:39 PM
  2. Filtering a recordset
    By Mithrandir in forum Macromedia ColdFusion
    Replies: 1
    Last Post: April 4th, 10:26 PM
  3. Help with RecordSet filtering
    By slakker01 in forum Dreamweaver AppDev
    Replies: 1
    Last Post: March 31st, 10:12 PM
  4. filtering recordset
    By WebSlave in forum Dreamweaver AppDev
    Replies: 3
    Last Post: March 26th, 01:51 PM
  5. Please help: Filtering recordset from URL Folder
    By Dolg webforumsuser@macromedia.com in forum Macromedia Dreamweaver
    Replies: 1
    Last Post: July 28th, 02:57 PM

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
  •  

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