# Database search / export to repeater

**URL:** <https://forum.wixstudio.com/t/database-search-export-to-repeater/26647>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [February 10, 2020, 3:14pm UTC](https://forum.wixstudio.com/t/database-search-export-to-repeater/26647 "2020-02-10T15:14:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrejackson](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/andrejackson/32/17195_2.png) [@andrejackson](https://forum.wixstudio.com/u/andrejackson)\
**Post date:** [February 10, 2020, 3:14pm UTC](https://forum.wixstudio.com/t/database-search-export-to-repeater/26647/1 "2020-02-10T15:14:53Z")

</div>

Hi mates, I need some help! 🙂

I would like to use a very little code to search a database by using a ‘user text field’ (“input”) in combination with a ‘search button’ (“iconButton1\_click”) and an export of the results to a ‘repeater’ (“repeater1”).

Database (“MGL-III”) and repeater are working fine on the site but ‘the search’-code doesn´t. Nothing happens while using text field and button. Can you help?

This is the little code I am “using” right now:

import wixData **from** ‘wix-data’;  
export function iconButton1\_click(event) {  
**function** search() {  
wixData.query(‘MGL-III’)  
.contains(‘kurztext’, $w(“#input”).value)  
.or(wixData.query(‘MGL-III’).eq(‘title’, $w(“#input”).value))  
.find()  
.then(res =\> {  
$w(‘#repeater1’).data = res.items;  
});  
}  
}  
Thank you guys very much in advance!  
Nice regards from the Baltic Sea-area 🙂  
André

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [February 10, 2020, 4:22pm UTC](https://forum.wixstudio.com/t/database-search-export-to-repeater/26647/2 "2020-02-10T16:22:34Z")

</div>

I have used similar on a site for searching with a button, although my results were shown in a table and not in a repeater.

```javascript
import wixData from 'wix-data'

 $w.onReady(function () {

    $w('#searchButton').onClick(function () {

        wixData.query("RepertoireList")
            .contains("songName", $w("#searchInput").value)
            .or(wixData.query("RepertoireList")
                .contains("artistName", $w("#searchInput").value))
             .find()
             .then((results) => {
 let resultsItems = results.items;
                console.log(resultsItems);

                  $w('#resultsTable').rows = resultsItems;
            })
    })
 })

```

Where I have the onClick event handler line, I had to add the onClick from the properties panel for that button element.

So, where you have your own onClick event handler on your icon button, you will need to make sure that you also have the onClick event function handler added to the button through the properties panel.

You can see more about it here.

> **[Velo: Working with the Properties & Events Panel | Help Center | Wix.com](https://support.wix.com/en/article/velo-working-with-the-properties-events-panel)**
>
> Visit the Velo by Wix website to onboard and continue learning.
> See what the Properties and Events panel looks like hereThe Properties and Events panel lets you

> **[Velo Tutorial: Adding Custom Interactivity with Events | Help Center | Wix.com](https://support.wix.com/en/article/velo-tutorial-adding-custom-interactivity-with-events)**
>
> Visit the Velo by Wix website to onboard and continue learning.In this tutorial, we’ll show you how to set up an image so that it’s hidden when the page loads,

Plus, have a look sat this example from Vorbly as it is a great little example for a search using repeaters.  
[https://www.vorbly.com/Vorbly-Code/WIX-CUSTOMIZED-SEARCH-BAR-USING-REPEATERS](https://www.vorbly.com/Vorbly-Code/WIX-CUSTOMIZED-SEARCH-BAR-USING-REPEATERS)

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [February 10, 2020, 4:26pm UTC](https://forum.wixstudio.com/t/database-search-export-to-repeater/26647/3 "2020-02-10T16:26:22Z")

</div>

Also, note that the eq function from Wix Data Query is case sensitive too.

[https://www.wix.com/corvid/reference/wix-data.WixDataQuery.html#eq](https://www.wix.com/corvid/reference/wix-data.WixDataQuery.html#eq)  
Matching strings with eq() is case sensitive, so “text” is not equal to “Text”.

So if people search for your name for example, if they search for Andre they will find your name, whereas if they search for andre they won’t.

---

<div class="post-metadata">

**Author:** ![andrejackson](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/andrejackson/32/17195_2.png) [@andrejackson](https://forum.wixstudio.com/u/andrejackson)\
**Post date:** [February 11, 2020, 2:20pm UTC](https://forum.wixstudio.com/t/database-search-export-to-repeater/26647/4 "2020-02-11T14:20:25Z")

</div>

Hi GOS, thank you very much for your support!!! I will give it a try and report back to you soon… Nice regards, André
