I need a functionality where i need to generate a alphanumeric code based on the type of customer selected.
For e.g. if the Customer is of Type A then i need to just generate a numeric value. e.g. 5000 is the current and the new one will be 5001.
For e.g. if the Customer is of Type B then i need to just generate an alphanumeric value.
e.g. XXX C5000 is the current and the new one will be XXX C5001.
I have created a table with following fields. (Please see the attached .txt file)
Type of Customer text e.g. A
Prefix text XXX C
NeedsPrefix Boolean True
NumericValue int 1000
I have got the logic of how to go about doing this but I need help to create a function where i pass in type of customer and it will return me a new code.
In the function it will check if NeedsPrefix is true then it will join the prefix & max of NumericValue and return that and will also increment the NumericValue for next/new record.