locked
How to query the sharepoint list using a wildcard text in infopath RRS feed

  • Question

  • Setup:

    Sharepoint 2007:
    List with single column (item_name) with 40 rows (40 item_names)

    Infopath 2007:
    Listbox - which populates all 40 items from the sharepoint list.
    Textbox - To input text to search from the Sharepoint List and populate result to the listbox after refreshing the list
    Button - To query the list and return the resultset to the list

    I would like to enter ... lets say the word: gent and should return all items starting with gent.... (something like gent%)

    Gent is the wild card

    And the search button should query the List and populate the listbox (after refreshing) with the result

     

    Need assistance with this pls.

     


    • Moved by Clayton Cobb Sunday, April 17, 2011 3:37 AM 2007 question (From:SharePoint 2010 - Using SharePoint Designer, Infopath, and other customization)
    Saturday, April 16, 2011 5:17 PM

Answers

    1. This is the 2010 forum, but your question only refers to 2007
    2. If it's a browser form, then you can't filter at all from a SharePoint list
    3. If you're using a list data connection, then there is no built-in query feature
    4. Even in 2010 with the ability to query, there is no wildcard capability

    All that being said, you are either going to have to add code to the form or write a custom web service that can retrieve data with wildcard queries.


    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    • Marked as answer by Emir Liu Monday, April 25, 2011 2:18 AM
    Saturday, April 16, 2011 11:06 PM

All replies

  • Do you want to make it for read only and search? You can put your data in a repeating table, Drag and drop your data connection to the design surface, Choose repeating table. Show the fields you want as you like. Now click on the repeating table, and in the manage rules tab, click formatting. In the condition, If title doesn't contain YourTextBoxValue , then choose hide. This will show all of your items in a repeating table, then will hide the items that doesn't contain what you enter in the textbox.

    Note that you didn't filter the data connection before you retrieve it, to do so you need code. And the listbox control doesn't have a capability to filter items out of the box except for showing unique items or filter the items through the properties, then clicking entries field.


    Mohamed Derhalli ||| SharePoint Specialist ||| http://Path2SharePoint.com
    • Edited by Mohamed Derhalli Saturday, April 16, 2011 7:00 PM
    • Proposed as answer by AbhiW Tuesday, March 31, 2020 7:11 PM
    Saturday, April 16, 2011 5:54 PM
  • We are a bit off track on this.

    The info path has 3 controls:

    Listbox, Textbox and button

    When the form loads, it automatically populates the listbox with the Item_name (all 40 items are listed).

    As the list is huge (and will  grow), I would need the option of searching for the item_name as a wildcard and showing the result of various items in the listbox.

    Please help with details on how to re-query the list by clicking on the button and using the text in the textbox.

    Can not use C# or VB code on this yet.

     

    Saturday, April 16, 2011 6:15 PM
  • The only way to make your filter here is to go to the listbox properties, click beside entries field, and choose filter data, where your Title contains your textbox, You don't have to include a button in this. You filter after you query.
    Mohamed Derhalli ||| SharePoint Specialist ||| http://Path2SharePoint.com
    Saturday, April 16, 2011 6:54 PM
    1. This is the 2010 forum, but your question only refers to 2007
    2. If it's a browser form, then you can't filter at all from a SharePoint list
    3. If you're using a list data connection, then there is no built-in query feature
    4. Even in 2010 with the ability to query, there is no wildcard capability

    All that being said, you are either going to have to add code to the form or write a custom web service that can retrieve data with wildcard queries.


    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    • Marked as answer by Emir Liu Monday, April 25, 2011 2:18 AM
    Saturday, April 16, 2011 11:06 PM
  • Thanks on the update Clayton.

    I will see how I can get the code into the wildcard searches

    Sunday, April 17, 2011 9:23 AM
  • Many thanks. I was looking for this solution for weeks!!!
    Tuesday, March 31, 2020 7:11 PM
  • Is there a way to have count of items searched as a result of query+filter displayed somehow on top of each column hence?
    Tuesday, March 31, 2020 7:12 PM