Assign database value as variable

Hi, I’m trying to get the data from my database. Collection name is “cottonj” & field name is “labour” which is number. Purpose is to get the value from database & assign it as a variable so that I can perform operations on it. Thanks you in advance!

Just simply get the required item from your dataset.
https://www.wix.com/corvid/reference/wix-dataset.Dataset.html#getCurrentItem
$w(“#dataset1”).getCurrentItem(); // for all row data
$w(“#dataset1”).getCurrentItem().fieldName; // for just that field data only

If it is a number and you want to use it in a text box then you need to change it using toString.
https://www.w3schools.com/jsref/jsref_string.asp

If you want to do a text (string) into a number, then you simply use parseInt.
https://www.w3schools.com/jsref/jsref_parseint.asp

Hi, Sorry I didn’t check this. But thanks for your valuable time & details. Your answer contains all the details regarding which I got issues earlier. Now, I resolved that. In future, I will let you know for further questions. Thank you so much once again!