formatNumber in script

value1 = event.source.parent.getComponent(‘GroupName’).text
value2 = event.source.parent.getComponent(‘Spinner’).intValue
value3 = numberFormat(value2, 0000)

#idNumber = system.db.runScalarQuery(“SELECT MAX(store) + 1 FROM shipping_stores”)
system.db.runUpdateQuery(“INSERT INTO shipping_stores (store) VALUES (’%s’)” % (value3), ‘Sample’)
system.db.runUpdateQuery(“UPDATE shipping_stores SET groupname = ‘%s’ WHERE store = ‘%s’”% (value1, value3), ‘Sample’)

Here is a script that works fine for value 2, but I am inserting an int value that needs formating.
I keep getting an error saying that numberFormat does not exist.

What should I use to format my int to a 4 digit value?


value3 =  "%04d" % value2

You’re trying to use the numberFormat function from the expression language inside a jython script, which isn’t going to work.

numberFormat is an expression function, not a scripting one.

Try using:

value3 = “%04d” % value2

EDIT: Dang! Kevin beat me to it! :laughing:


EDIT: Dang! Kevin beat me to it! :laughing:[/quote]
thanks, you guys