Optional Search field?
Last Post 12-07-2009 08:18 AM by Deb Herman. 8 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
Richard BaileyUser is Offline
going with the flow
going with the flow
Posts:66
Avatar

--
03-16-2009 10:38 AM

    Thanks guys so far with your help - moving my questions to the forum so they help all...

    Is it possible for a search field to be optional?

    In my first use I'd like to have the option to search by First Name or Last Name or Region or Custom Profile Field.

    Is this possible or is AND the only option???

     

    Thanks,

    Rich

    Richard BaileyUser is Offline
    going with the flow
    going with the flow
    Posts:66
    Avatar

    --
    03-16-2009 12:36 PM

    Much thanks to the awesome support and guidance - have optional search field working beautifully, and also have an ANY or ALL field for the combobox.

    For the combo box query I used the following, which results in an Any option to be listed in the drop down along with all of the available regions.

     


     

     

     

    'Any' AS SearchOption, '' AS SearchOptionValue[Text] AS SearchOption, [TEXT] AS SearchOptionValueLists

    WHERE

    ListName = 'Region'

     

     


     

    I also needed to enhance this a bit to only list regions where contacts were available... this is a bit quirky, and there is probably a better option like using a JOIN, but it works swimmingly.

    SELECT

    'Any' AS SearchOption, '' AS SearchOptionValue

    UNION ALL

    SELECT

    [Text] AS SearchOption, [TEXT] AS SearchOptionValue

    FROM

    Lists

    WHERE

    ListName 'Region'

    and [Text] in (select distinct [PropertyValue] from UserProfilewhere PropertyDefinitionID = '28')

     

    FROM

    Richard BaileyUser is Offline
    going with the flow
    going with the flow
    Posts:66
    Avatar

    --
    03-16-2009 12:37 PM

    Note - FCK editor totally wasted my queries above - sorry about that - complain to the FCK editor folks about how junky the newer version is.

    Deb HermanUser is Offline
    going with the flow
    going with the flow
    Posts:37
    Avatar

    --
    12-04-2009 03:52 PM
    I to am trying to implement optional searching. I have not had success. I assuming we are trying to put a option value pair where the value = blank. Does dynamic directory then create the query as optional if the value is blank. The beginning of this thread seems to be missing. I have
    select 'Any' as SearchOption, '' as SearchOptionValue union all
    select Text as SearchOption, Text as SearchOptionValue from
    lists where listname = 'Country'
    If "any" is selected in the combo box, nothing returns in the directory
    Deb HermanUser is Offline
    going with the flow
    going with the flow
    Posts:37
    Avatar

    --
    12-04-2009 04:24 PM

    I've tried both "" blank and null as the search option value for an optional search value in a combo box.  Neither work with equals and the operator but it does work with begins with.  This does not appear to be working as documented or I'm not understanding the documentation.  Would really appreciate some help on this.

    Richard BaileyUser is Offline
    going with the flow
    going with the flow
    Posts:66
    Avatar

    --
    12-04-2009 04:36 PM

    Doh!  posting via FCKEditor messed up the query, I can't remember exactly what we did...

    Richard BaileyUser is Offline
    going with the flow
    going with the flow
    Posts:66
    Avatar

    --
    12-04-2009 04:47 PM
    Oh, I think we used "Begins With" for the search conditions...

    so if they chose the ALL, with value of '', the resulting search query would be like the following

    select * from users where username like '%'

    or if they picked one of the names

    select * from users where username like 'admin%'

    I'm not 100% sure if that is what we did... sorry!
    David ToUser is Offline
    river guide
    river guide
    Posts:2719
    Avatar

    --
    12-07-2009 06:56 AM
    You might also want to checking into using "Contains". If you leave it blank, it should return everything. -- David
    Deb HermanUser is Offline
    going with the flow
    going with the flow
    Posts:37
    Avatar

    --
    12-07-2009 08:18 AM
    Thanks everyone, yes that works. I was thinking it would generate
    where username like ' %' which would not work.

    Now if I could just get the directory to display correctly in firefox. But that's another thread.


    ---
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi