Cannot Read Property "field' of Null

Hi y’all, I’m facing a challenge that just can’t figure out hope someone in the community can help. I have a dataset on a a page using the get function to display results in various text boxes. There are 40 wixData.get requests on my page code for example:

$w.onReady(function () {
$w("#dataset16").onReady(()=> {
wixData.get("SiteMap", 'b7780cf1-f4a2-4b80-9dd6-8c4374844c15')
  .then( (results) => {
 let item = results;
  $w('#ajax').html = results.city;
  $w('#ajax1').html = results.services1;
  $w('#ajax2').html = results.services2;
  $w('#ajax3').html = results.services3;
})

wixData.get("SiteMap", '117238aa-eb4b-4e1e-b4e2-3f096e151361')
  .then( (results) => {
 let item = results;
  $w('#aurora').html = results.city;
  $w('#aurora1').html = results.services1;
  $w('#aurora2').html = results.services2;
  $w('#aurora3').html = results.services3  
})

and 38 more similar to above

The first 20 or so display properly however the remaining only display the last item in the collection and I see an error "cannot read property “city” of null. But the city field is populated with data.

Has anyone come across this problem and a fix. How can I correct the error if the field is not “NULL”

ANY IDEAS ANYONE? BIG THANKS FOR YOUR HELP.

instead of
$w ( ‘#aurora’ ). html = results . city ;
try
$w ( ‘#aurora’ ). html =${ results['city'] } ;

$w ( ‘#aurora’ ). html = results . city ;
if the object results does not have the property city it will throw an error and stop execution

you could also try this

$w ( ‘#aurora’ ). html = (results .hasOwnProperty(" city"))? results . city:“No city property found” ;

not sure why you are using .html instead of .text though

Thank you for your fast response! I will try your suggestions right away! Using .html because the text boxes are connected to rich text field in database…

I tried both code but no dice my friend. Thanks for your suggestion though, I have 40 .get functions in the page code , the first 23 display the correct content from database the remaining 17 show the last item in the collection and Maybe a glitch when I imported the data to the DB, maybe I’ll export the items recreate the database and import again see if that fixes the problem. Unless there’s some kind of limit with calling .get 40 times I can’t think of what else it could be.

wixData.get("SiteMap",'117238aa-eb4b-4e1e-b4e2-3f096e151361')
.then((results)=>{
let item = results;
$w('#aurora').html = results.city;
$w('#aurora1').html = results.services1;
$w('#aurora2').html = results.services2;
$w('#aurora3').html = results.services3   })