Running a query

I am really struggling to get off the ground

I wrote some code all in an $w.onReady(function () {}

Initialised all, everything else works except the query. the value of text box #inputText2 remains “outcome” as initialised

wixData.query(“Registration2018”)
.then( (results) => {
let item = results.items; //puts results in item
$w(“#inputText2”).text = " Success";
} )
.catch( (err) => {
$w(“#inputText2”).text = " Fail";
} );

I tried
wixData.query(“Registration2018”)
.find()
.then( (results) => {

This at least set #inputText2 to fail (some progress!)

Clearly falling at the first but cannot see where I am going wrong

1 Like

Hi,

the actual syntax is

wixData.query('collection')
  .find()
  .then((result) => doSomethingWithResultItems(result.items))
  .catch((error) => console.log(error));

I suggest you log the error to console, to check what the issue is.

Many thanks

Have worked on it since posting and making progress