Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Step-by-step guide

use the following script (courtesy of Jason Coope)

Code Block
def secureNextLotName():

	query = "SELECT Number FROM mesnumber where `key` = 'Lot'"
	mesDB = system.tag.getTagValue("[System]Client/System/DefaultDatabase")
	lotNum = int(system.db.runScalarPrepQuery(query,[],mesDB)) + 1
	query = "UPDATE mesnumber SET Number = ? where `key` = 'Lot'"
	system.db.runPrepUpdate(query, [lotNum], mesDB)
	lotName = str(lotNum)

	return lotName.zfill(10)
	
lotName = secureNextLotName()

print lotName

...