Hey
What does your Data Collection look like? What fields do you have to use for this calculation? Screenshots help if possible. It also depends on if you use a Dataset or if you use just Wix-Data to query and work with data.
If you use a data set you can get the currentItem you have on page and then use the setFieldValue to alter values in data collection fields. Then you can use the save method on the data set to save back the modified information to the data collection.
So if you use data set, read the API docs and look at the setFieldValue and Save operations and you will see a lot on how to accomplish this.
Then you must check if one value is less than the other and to do that you need the fields to be Number or you have convert the contents to float or number before doing the check.
If (field1 < field2) {
// They have valid resources in account
} else {
// The don’t have the resources to withdraw this amount
}
You can use parseFloat on the fields to convert and check if float or Number(value) to make sure it is a number. It will be crucial when saving back the resulsts you save it in the correct format, string or Number.