Ok so I am getting into this a bit. Here is my first try:
import wixData from ‘wix-data’ ;
let ReturnText = “start value”
wixData.query( “ZG-HTMLTEST” )
.eq( “title” , “Test1” )
.find()
.then( (results) => {
if (results.items.length > 0 ) {
let ReturnText = results.items[ 0 ];
} else {
let ReturnText = “no result XXX”
}
} )
. catch ( (err) => {
let ReturnText = err;
} );
$w.onReady( function () {
$w( ‘#text249’ ).text = ‘Text from Variable’ ;
$w( ‘#text251’ ).text = ReturnText
});
The ZG-HTMLTEST collection exists and has title with value Test1. How come this is not finding anything. I always get ‘start value’ as a result