how can I +1 to the existing number in the collection?
when a user clicks a button I want to use an update service to +1 the existing number in a certain field for a certain row.
at the moment I have a read service on page show that maps the existing number to a label, and on update service mapping I have the code
pre
var numbB4 = value;
var newNum = numbB4 + 1;
return newNum;
/pre
This method has a flaw though. If a user1 opens the page, invokes the read service, then sits idle for 30 mins, then invokes the update service. they will be using the existing value from the label that is 30 mins old. in this time user2 could have opened the page, invoked the read service, and invoked the update service.
I could have an additional read service called just before the update service on button click, to retrieve the latest 'existing number'. but I wan't to reduce the amount of api calls.
so is there a way that the update service can just +1 to what ever value is there, rather than removing it and replacing it with a new one?
Thanks