How to use greater than to relate data in a database field

I would like to put a condition on a onclickbutton event that checks whether a value in a database field is greater than a user input value. I have a dataset that connects the two but i have found it difficult to come up with the code. Anyone can help, i will appreciate.

Your onClick() function should look something like this:

export function button1_click(event, $w) {
    let val = $w("#input1").value;
    console.log(val);
    let item = $w("#dataset1").getCurrentItem();
    console.log(item);
    if( val > item.field ) {
        // do whatever it is what you want to do here
    }
}

The code gets the value from an input field, and compares it with the database field from the current dataset item.

I hope this helps.

Yisrael

Thank you so much. It helped