I want to display data in a table from a dataset based on user input and give a message if no data exists for the given condition/input

@prabhavp380
Surely you would be able to solve this issue without any coding, by sorting your Db with help of the DATASET. But i prefer to work the coding way, because this way is always more flexible one.

So, your steps in this case should be…

  1. First quering your DB
  2. Filtering for the right value in the right data-field.
  3. Find all possible / matching results.
  4. Then get the output.
  5. And populate a table, a dropdown, or a repeater with the output-data.

You will need something like this…

import wixData from 'wix-data';

$w.onReady(function() {myFunction()});

function myFunction(){
   let FIELD = "YourFieldIDhere"
   let VALUE = $w('#YourInputFieldhere').value

   wixData.query("IdOfYourCollectionHere")
  .eq(FIELD, VALUE)
  .find()
  .then( (results) => {
     if(results.items.length > 0) {
        let items = results.items; console.log(items)
     } 
     else { console.log("No entries found!") }
  })
  .catch( (err) => {let errorMsg = err;});
}