# question about search function in a simple wixcode

**URL:** <https://forum.wixstudio.com/t/question-about-search-function-in-a-simple-wixcode/38795>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [April 16, 2018, 1:23am UTC](https://forum.wixstudio.com/t/question-about-search-function-in-a-simple-wixcode/38795 "2018-04-16T01:23:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lis-liang](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/lis-liang/32/3117_2.png) [@lis-liang](https://forum.wixstudio.com/u/lis-liang)\
**Post date:** [April 16, 2018, 1:23am UTC](https://forum.wixstudio.com/t/question-about-search-function-in-a-simple-wixcode/38795/1 "2018-04-16T01:23:57Z")

</div>

Hi everyone ! I was trying to set up a simple wix code that could perform easy function such as type a word and i have a table that shows that info in the database.

I uses  
// For full API documentation, including code examples, visit [http://wix.to/94BuAAs](http://wix.to/94BuAAs)  
import wixData from ‘wix-data’;

$w.onReady(function () {  
//TODO: write your page related code here…

});

export function searchButton\_onclick(event) {  
wixData.query(‘recommendation’).contains(‘newField’, $w(‘#input1’).value)  
.find()  
.then(res =\>{$w(‘#table1’).rows= res.item;  
});

}  
and created a input field, a button and a table … but i cant really make that works…  
the table change a bit after i hit the button but then it didnt show the data … it just react …

and i receive an error message : Wix code SDK Warning: The rows parameter that is passed to the rows method cannot be set to null or undefined.

any idea? thanks in advance!

---

<div class="post-metadata">

**Author:** ![lis-liang](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/lis-liang/32/3117_2.png) [@lis-liang](https://forum.wixstudio.com/u/lis-liang)\
**Post date:** [April 17, 2018, 11:29pm UTC](https://forum.wixstudio.com/t/question-about-search-function-in-a-simple-wixcode/38795/2 "2018-04-17T23:29:08Z")

</div>

any idea ??? T^T…

---

<div class="post-metadata">

**Author:** ![yisrael-wix](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/yisrael-wix/32/1107_2.png) [@yisrael-wix](https://forum.wixstudio.com/u/yisrael-wix)\
**Post date:** [April 18, 2018, 5:46am UTC](https://forum.wixstudio.com/t/question-about-search-function-in-a-simple-wixcode/38795/3 "2018-04-18T05:46:34Z")

</div>

Hey Lis,

Welcome to the Wix Code forums.

Seems like you need **items** and not **item**.

Not this:  
**.then(res =\>{$w(’** [**#table1**](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23table1) **').rows= res.item;**  
but this:  
**.then(res =\>{$w(’** [**#table1**](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23table1) **').rows= res.items;**

Let me know if that helps,

Yisrael

---

<div class="post-metadata">

**Author:** ![lis-liang](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/lis-liang/32/3117_2.png) [@lis-liang](https://forum.wixstudio.com/u/lis-liang)\
**Post date:** [April 18, 2018, 11:07pm UTC](https://forum.wixstudio.com/t/question-about-search-function-in-a-simple-wixcode/38795/4 "2018-04-18T23:07:20Z")

</div>

thanks Yisrael !! it helps ! the error message is gone… but the problem still here which is the table is not showing the search result… the table do change but then it changes to nothing … the first one is before i do anything… the second one is when i do hit the button for search … … thanks in advance !! Yisrael !

 ![](https://us1.discourse-cdn.com/wix/original/3X/6/e/6e32a1db114d4efc5ae788b6628648d6d42febfc.png)

 ![](https://us1.discourse-cdn.com/wix/original/3X/a/c/ac10ef65c73ef949ead7f46f5a2e6bd7df8dd20d.png)

---

<div class="post-metadata">

**Author:** ![lis-liang](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/lis-liang/32/3117_2.png) [@lis-liang](https://forum.wixstudio.com/u/lis-liang)\
**Post date:** [April 20, 2018, 12:57am UTC](https://forum.wixstudio.com/t/question-about-search-function-in-a-simple-wixcode/38795/5 "2018-04-20T00:57:28Z")

</div>

is it possible that i didnt link these 3 items correctly ??? because it doesnt seem connected , ☹

---

<div class="post-metadata">

**Author:** ![yisrael-wix](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/yisrael-wix/32/1107_2.png) [@yisrael-wix](https://forum.wixstudio.com/u/yisrael-wix)\
**Post date:** [April 22, 2018, 5:36am UTC](https://forum.wixstudio.com/t/question-about-search-function-in-a-simple-wixcode/38795/6 "2018-04-22T05:36:09Z")

</div>

Hi Lis,

From what it looks like to me, you are searching in the recommendation field for a entry that has the lower-case (small) letter **a**. However, the table that you are displaying has all upper-case letters. Try searching for the upper-case letter **A** and you will probably get some results.

You could also do this:

```javascript
wixData.query('recommendation').contains('newField', $w('#input1').value.toUpperCase())

```

This converts the entire search string to upper case for the filter.

Good luck,

Yisrael

---

<div class="post-metadata">

**Author:** ![lis-liang](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/lis-liang/32/3117_2.png) [@lis-liang](https://forum.wixstudio.com/u/lis-liang)\
**Post date:** [April 23, 2018, 12:53am UTC](https://forum.wixstudio.com/t/question-about-search-function-in-a-simple-wixcode/38795/7 "2018-04-23T00:53:56Z")

</div>

Thanks for all your input Yisrael ! i find out why… it is because the connection between the table and the database XD… thanks !
