Data Collection Searching (Advanced) Print

  • Data Collection
  • 0

It should be noted that searching data collections is currently an advanced topic and is under active development. The proposed solution below is currently a workaround with a more polished version to be coming soon. 

  1. Under the Data Collection you want to search, go to the Layouts  tab and click the Add Layout button and name your new layout something like DC Search Results. Alternatively, you can just use the default List View Layout if your Data Collection's primary purpose is to show search results.
  2. Edit the layout and use {{FieldName}} tags that belong to your Data Collection Items. BlueberryCMS will loop this layout for each item in your Data Collection until it runs out of items to display. For example:
    <li>{{dataName}}</li>
    <li>Publish Date: {{PublishDate}}</li>
  3. Create a Web Page for your search results to appear like DC Search Results. Somewhere in the contents of the page, insert the bb_tag for:
    <ul>
    {bb_datacollection source="Your Data Collection" layout="DC Search Results"}
    </ul>
  4. Create a Web Form with a name that is easy to remember like DC Search Form.
  5. Build your form however you'd like, making sure to use fields that match the names of real Data Collection fields. Whether it's just a text input, or if you require various filtering levels, use a drop-down menu of data collection item names.
  6. Go to the Customize tab and click the Sync button. 
  7. Locate the <form> line and replace with the following:
    <form name="" action="/SubmitDCSearch?DCSearchSource=Your+Data+Collection&ResultsUrl=DC-Search-Results" method="post">
  8. Modify the ?DCSearchSource value type in the name of your Data Collection. Use the + sign to indicate spaces. 
  9. Modify the &ResultsUrl value to equal the URL of the Web Page you want to be displayed when a user clicks Submit and displays the results of the search. 
  10. Remove any form input fields and references to the default Web Form fields such as First Name, Last Name, and Email, unless of course your Data Collection search needs to contain those items.
  11. Create an input field for a basic search text box and include the Field Name that you're searching through in the name="" attribute. Search more than one Field Name using a piped list.
    <input id="search" name="Item_Name|Description" type="text"> 
  12. Open a Web Page, Page Template, or Include File, and place the following code where you want the search form to appear:
    {bb_webform source="DC Search Form"} 
  13. Test out your results!

Using Query Strings in the URL

This is a very useful way to create your own hyperlink to list a custom list of search results. Be sure to use %20 for spaces and other URL character codes.

https://demo.secureworldservers.com/YourAgency/YourWebsite/search-page/?DCSearchSource=Your%20Data%20Collection&FieldName=Value&FieldName2=Value
  •  ?DCSearchSource=Your%20Data%20Collection - Replace with the name of your data collection.
  • &FieldName=Your%20Search%20Term - Replace FieldName with the name of your field and the search term with the value you want to search for. Append more &FieldName attributes to search more than one field at a time.  Such as &FieldName1=SearchWords&FieldName2=OtherSearchWords

Was this answer helpful?

« Back

Powered by WHMCompleteSolution