AnsweredAssumed Answered

Serial number problem

Question asked by SueHess on Sep 10, 2014
Latest reply on Sep 12, 2014 by philmodjunk


Serial number problem


I have a contact database that creates a Vendor Number (serial ID) upon creation.  The format for that number is CP0001, CP0002, etc.  The database contains vendors and customers.  I have written a script to clear the number when a customer is chosen for the record and reset the serial ID.  The issue I am having is that instead of the script performing the MAX function it is reverting the next available serial number to CP0001.  I have set up a self-join relationship also and the issue persists.  Script is below.  Not sure what I am doing wrong.

If [address::${Customer or Supplier} = “Customer”]

      Go to Field [address::Vendor#]

      Clear [Select; address::Vendor #]      

      Set Next Serial Value [address::Vendor #; Max (address 2::Vendor #; “CP”&Right (“0000” & address::Vendor # +1; 4))]

End If