Hello…i was tryin to retrieve the field values of one dataset with that code:
$w( “#dataset1” ).onReady( () => {
$w( “#dataset1” ).getItems( 1 , 1 )
.then((result) => { let item = result.items.cleanJerk; let totalCount = result.totalCount; let offset = result.offset;
console.log(item)
$w( ‘#text183’ ).text = JSON.stringify(item)
} )
. catch ( (err) => { let errMsg = err.message; let errCode = err.code;
});
but that shown only UNDEFINED
If I use this let item = result.items;
I get the following object, how can i retrieve one of the above field?
let item = result.items;
let weight = result.items.weight; console.log(weight)
let ID = result.items._id; console.log(ID)
let OWNER = result.items._owner; console.log(OWNER)
let EMAIL = result.items.email; console.log()
Add this code-parts to your CODE and take a look onto CONSOLE after running your code.
This screenshots do not really help.
Try to debug it by your own.
You told in your last post that you get the following results…
I get the following object, how can i retrieve one of the above field?
cleanJerk: 130
weight: 76
benchPress: 100
email: “d.zibra@yahoo.it”
_id: “10544d32-f484-47f0-aa55-1fe052227744”
_owner: “10544d32-f484-47f0-aa55-1fe052227744”
You now should take a look onto the structure of this object in the console (use the console of Google-Chrome.)
Once you have the results in front of your eyes, take a look how it is structured.
let weight = result.items[0].weight; console.log(weight)
let ID= result.items[0]._id; console.log(ID)
let OWNER= result.items[0]._owner; console.log(OWNER)
let EMAIL= result.items[0].email; console.log(EMAIL)
I Tried some values and seems to work…
thank you very very very much @russian-dima !!!
in the next days I will finish the page where i am working and see if there is any other problem.
you saved my website