Printing Report with parameter inputs

I have a report that details the parts of an assembly. the parts are loaded onto a cart, but the cart can only hold so many parts. Thus each assembly has a maximum load quantity. when it is exceeded the order should be broken up into multiple carts. My code for my print button to do this is shown below. It works perfect except I the quantity at the top is always the same on each print. The Load Qty. is the parts per assembly times the quantity parameter. These update perfectly with the code, but the parameter label in the upper right hand corner shows the original quantity instead of updating. any ideas??

max = system.tag.read("CNC_Global/StyleMaxQty").value
qty = system.tag.read("CNC_Global/StyleQty").value

	
while qty > max:
   	params = {'Qty':max}
   	system.report.executeAndDistribute(path='LoadSheet', 
   	project='CNCManagement',
   	parameters = params,
   	action='print', 
   	actionSettings = {'primaryPrinterName':event.source.parent.getComponent('PrinterSelect').selectedStringValue,
   	'copies':1})
   	qty = qty - max
   	 			
params = {'Qty':qty}
system.report.executeAndDistribute(path='LoadSheet', 
project='CNCManagement',
parameters = params,
action='print', 
actionSettings = {'primaryPrinterName':event.source.parent.getComponent('PrinterSelect').selectedStringValue,
'copies':1})

I might should mention that the quantity parameter is a query tag being overridden by the parameter input on the system.report.executeAndDistribute() function. maybe it’s still using the tag value in the print instead of the parameter input? If it is then why is my load qty. updating like it should?

I got it to work, but I don’t really like the solution I figured out… The quantity label in the upper right hand corner was dragged and dropped directly from the parameters list. The load quantities that were updating were all apart of a calculation. I took the quantity parameter label, and changed it to @Qty*1@ multiplying it by one to make it a calculation. This works but I don’t like having to remember to do this every report that I need this for.

I don’t see anything obviously wrong with your setup, but we also haven’t encountered this issue that I can see. Can you contact support so they can take a look and make sure there’s not some subtle bug? (or help you figure out a simpler solution)

I’m not a 100% sure on this, but on the report viewer I forgot to bind the qty parameter to the query tag. When I fixed this the qty on the report showed N/A. I deleted the times 1 I added, and now it seems to be working correctly (so far). I figured this wouldn’t affect the executeandDistribute() since it passes the parameters directly, but it’s working is all I know :slight_smile: