This is my code below, the filter filters the field key " whoReferredYou"with a specific referral code value saved as X after dataset10 has been filtered based on the current loggedin owner. The problem is when the button has been clicked, the dataset is filtered accordingly and the “APPLIED” Value only replaces the first value of all the filtered results, but the new value “APPLIED” is not saved parmanently in the database, it only returns back to is original state after the page is refreshed. Please I need help on this, Thanks.
export function button55_click(event,$w) {
$w( “#dataset10” ).onReady(() => {
let X = $w( “#dataset10” ).getCurrentItem().referralCode
$w( “#dataset21” ).onReady(() => {
$w( “#dataset21” ).setFilter(wixData.filter()
.contains( “whoReferredYou” , X))
.then(() => {
let tem = “APPLIED”
$w( "#dataset21" ).setFieldValue( "whoReferredYou" , tem)
$w( "#dataset21" ).save()
})
})
})