Hi all
I have a form that creates an issue record for one of a number of locations ; the location is recorded when the form is initially completed. The issue record requires an ID in the form XXXX-YYY where XXXX is a location identifier and YYY is a sequence number.
At the moment I manually type in the issue ID but I have to remember what the location identifier is (XXX) and what was the last sequence number for this location.
Ideally I would like to generate the issue ID automatically. How can I approach this please?
In pseudocode I need to:-
- allow the user to select the location in the form (this bit is already there and looks up from an option set).
- look up an identifier associated with a location (the dentifier is already there as attribute of each option in the option set
- find the highest sequence number for this location (this is not stored separately it is just part of the issue ID which is currently just text
- increment the highest sequence number by 1
- concatenate this number onto the end of the location identifier with a hyphen
- write this identifier to the database
Can someoone please set me off in the right direction?
Thanks