Return from app

I have an operator input a number and then press “Save Button” to run the following:

[color=#0000FF]lotNum = event.source.parent.getComponent(‘tf_lotNumber’).text
ingName = system.tag.getTagValue("[Client]Tracking/Selected_Ing")
millName = system.tag.getTagValue("[Client]Tracking/Selected_Mill")
box = system.tag.getTagValue("[Client]Tracking/Select_Box_Count")
termFloor = system.tag.getTagValue("[Client]Tracking/Floor")
routine = 1
feeder1 = “”
feeder2 = “”

app.ingCode.buffer(lotNum)
app.Validate_Lot_Number.valid(ingCode, ingName, box, routine, millName, termFloor, feeder1, 0) # call validation app.

system.nav.closeWindow(“PopUp_Box_Count”)[/color]

#_______________________________________________________________________________

Application script module routine called by above code:

[color=#0000FF]def buffer(ingCode):

import app

length = len(ingCode)
bufferCount = 6 - length
if length < 6:
	for x in range(bufferCount):
		ingCode = '0' + ingCode
	
return ingCode[/color]

Is there a way to get this app to return the value of ingCode to the function that called it? The way I have tried it does not work.

It should return a value as you’ve written it. Make sure you’re assigning the return value to something. I assume you want it assigned to ingCode since you use that in the next function call.

ingCode = app.ingCode.buffer(lotNum)

Yes.

ingCode = app.ingCode.buffer(lotNum)