When I go and get a real weight from the scale the scale has its own internal record of all the weights it has taken and sends it's serial number along with the weight. So for each weighing I record in the my database the weight and serial number I get from the scale along with an identifier for the specific scale that provided the weight. However sometimes users need to record weights manually, for example they might know the tare weight of a truck and just want to type it in without actually weighing it. In this case I have to make up my own serial number which I used a generator for in the past.
Anyway I've got round it by just getting the maximum serial number for manual weights and just add one to it. I don't think there will be any concurrency issues.
MaxSerialNo := FManager.Find<TTallyRoll>
.SetProjections(TProjections.Max(dic.TallyRoll.SerialNo.PropName))
.CreateAlias(dic.TallyRoll.WeighbridgeID.AssociationName, 'W')
.Add(TExpression.Eq('W.ID', ManualWeighbridgeID))
.UniqueValue;
Thanks for your help, I have another question too, sorry to be a pain. I'll post it as a new subject as it's not the same issue.