# How to do when users write the correct words or code then the table gave the result

**URL:** <https://forum.wixstudio.com/t/how-to-do-when-users-write-the-correct-words-or-code-then-the-table-gave-the-result/51260>\
**Category:** Ask the community\
**Tags:** code\
**Created:** [August 6, 2023, 8:03pm UTC](https://forum.wixstudio.com/t/how-to-do-when-users-write-the-correct-words-or-code-then-the-table-gave-the-result/51260 "2023-08-06T20:03:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ismayrash](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/ismayrash/32/8483_2.png) [@ismayrash](https://forum.wixstudio.com/u/ismayrash)\
**Post date:** [August 6, 2023, 8:03pm UTC](https://forum.wixstudio.com/t/how-to-do-when-users-write-the-correct-words-or-code-then-the-table-gave-the-result/51260/1 "2023-08-06T20:03:39Z")

</div>

Hi, I’ve been using Wix for 4 years already  
I want that when users write correctly words or the code then the table gave result. If I write in #searchBar2 “188” the table gives all results in words that have “188”

I want the table to give a result when writing a correct query (words or codes).  
if I write a similar or incomplete query, then the table did not give a result.

there is my script, if you can fix it pls

//Search 1  
import wixData from ‘wix-data’;

$w.onReady(function () {

```
//SEARCH BUTTON TRIGGER⚡
$w("#searchButton").onClick(function () {
    search();
});

//ENTER KEY TRIGGER⚡
$w("#searchBar").onKeyPress(function (event) {        
    if (event.key === "Enter") {
        search();
    }

    
});

 $w("#searchBar1").onKeyPress(function (event) {        
    if (event.key === "Enter") {
        search();
    }

    });

 $w("#searchBar2").onKeyPress(function (event) {        
    if (event.key === "Enter") {
        search();
    }

    
});

//SEARCH FUNCTION🚀
function search() {

    $w("#dataset1").onReady(function () {
        $w("#dataset1").setFilter(wixData.filter().contains('ad', String($w('#searchBar').value))
                .and(wixData.filter().contains("marka", String($w('#searchBar1').value)))
                .and(wixData.filter().contains("detalCode", String($w('#searchBar2').value)))
                )

            .then(count)

        $w("#clearFilter").show();
    })
}

//COUNT FUNCTION👍
function count() {
    let count = $w("#dataset1").getTotalCount();
    if (count > 0) {
        $w("#countText").text = `${count} ehtiyat hissəsi tapıldı`;

    } else { $w("#countText").text = `ehtiyat hissəsi tapılmadı`; }

    return count;
}

//SCROLL TO THE TOP WHEN PAGINATION IS CHANGED ⚡

//CLEAR FILTER 🚀
$w("#clearFilter").onClick(function () {

    $w("#searchBar1").value = undefined;
    $w("#searchBar").value = undefined;
    $w("#searchBar2").value = undefined;
    //$w('#location').value = undefined;

    $w("#clearFilter").hide();
    $w("#dataset1").setFilter(wixData.filter()).then(count);

});

//COUNT BEFORE PAGE LOADS❗
$w("#dataset1").onReady(function () {
    count();
});

```

});
