HI All, hopefully someone be able to shed some light for me.
have a function query(as below)
async function getBalance ( myDatabase , usernameField , user ) {
return await wixData . query ( myDatabase )
. eq ( usernameField , user )
. find ()
. then (( results ) => {
let items = results . items ;
let item = items [ 0 ];
let cb = item.currentBalance,
let oh = item.onHoldNew
return (cb, oh);
})
}
then the display is
$w . onReady ( async function () {
getBalance ( myDatabase , usernameField , userName )
. then (( balance, onhold) => {
$w ( ‘#currentBalance’ ). text = String ( balance );
$w ( ‘#onhold’ ). text = String ( onhold );
})
})
i know the script is wrong. but can someone show me how it should be scripted?