change the boolean Field Type from true to false in the database...

I’m working on DYNAMIC-PAGE including a DYNAMIC-DATASET.

Is it possible to change the boolean Field Type in the database from true to false when I click the button in the current item page? how can I write this code?

I want to change “stock” value to false when I click the button.


I’m also using the dataset named “dynamicDataset”.

Thank you in advance <3

You do not describe your whole project-setup.

  1. You do not mention, that you are working on a DYNAMIC-PAGE including a DYNAMIC-DATASET.
  2. You do not mention, if you are using a REPEATER or a table.
  3. You do not mention, if you do use a DATASET at all.

I have just updated the post.

@qvelo78
Ok, now your setup is clear.
You have a dynamic-page (connected with a dataset).

You will need → getCurrentItem() ←
to get the data of the current item including all DB-values.

So how to do? How to write the code?

$w.onReady(()=>{
$w(‘#elementID’).onClick(()=>{
let myItem=$w(‘#dataset’).getCurrentItem().then(()=>{console.log(myItem);
//the rest of your code here…
console.log(myItem.title);
console.log(myItem.stock);
//changing stock-status…
myItem.stock=false;
console.log("stock-status after change ", myItem.stock);

  }); 

});
});