I want to select a record from data table using a where clause in an activity.
After a couple of computations I need to Update a column in the same record .
Do I use Obj-Browse , Obj-List , Obj-Open or Obj Open by Handle in this case. I am able to get it working with Obj-Browse but I want to make sure that is the correct method to use. Also does using Obj-Browse and obj-Save ensure that the lock is held on the record ?
By default DT classes allow locking, with obj-browse you can’t acquire lock which eventually avoids saving the data. Use obj-open with lock and release on commit check boxes checked by supplying keys, once you updated you can use obj-save to save the data.
Remember Obj-save is deferred operation, if you are performing this outside of flow you need to commit explicitly.
On the same lines - I do not know the key of the record I need to retrieve . Fox example I need to retrieve a record where say a Flag = "Y" . There may be many records with Flag = "Y" .
In that case , my understanding is I will need to use Obj-Browse to fetch the key. But at that time the record wont be locked . So another thread or request can update the record . Is there a way to resolve this issue? I want to retrieve a record first based on the flag (which is not the key) and then update the record.
In that case while obj-browse get the pzinskey as well and then iterate through each result using pzinskey use obj-openbyhandle with lock and release on commit check boxes checked. Then update and do obj-save.