Hi, I Currently have a situation i need help with a report printing. I have a report viewer. with a parameter called identity. this is a report that when printed should print the pallet number.
so the operators presses a PrintPallet button. then i execute my code (the end of my SP is below) get a parameter out. i put that parameter into the variable PalletID, I use this to put the variable into the parameter of the report. as soon as the report gets the parameter it will load. and then I run a Function that excecutes a print without a dialog. with an invoikelater to have time to load the report.
This was working fine until last week, we have much more traffice so the SP takes longer to execute, and the report also takes longer to load. so it is not loading on time. example is that if i print now pallet.
2004568 this load in the DB all perfect. but the report prints the number 2004567. next time this happens it should print 2004569 but it doesn’t it prints 2004568. so it s one late all the time.
I know I can partially fix this by increment the delay on the function, which I did to 1500ms instead of the 500 I have on the code below. this gives enough time and it prints correctly with the newvalue. but i don’t like this solution. I want to prevent this to happen completely, so i want to find a way to only print the report after the report executes and it’s ready with the newvalue. I need a trap or condition to prevent this and only print the report when the newvalue is already executed.
#only partial code foe store procedure, call.registerOutParam(3, system.db.INTEGER) call.registerInParam("action", system.db.INTEGER, action) call.registerInParam("maxid", system.db.INTEGER, maxp) call.registerInParam("minid", system.db.INTEGER, minp) system.db.execSProcCall(call) PalletID =(call.getOutParamValue(3)) event.source.parent.parent.getComponent('Report Viewer').identity = PalletID if PalletID!=(call.getOutParamValue(3)): system.gui.messageBox("<html><center>El Papel no fue impreso con el numero correcto<br> Por favor presionar Reprint Labels y Comunicar a Juan Pablo.") def printlabel(printreport = event.source.parent.parent.getComponent('Report Viewer')): import system printreport.print(None, False) printreport.print(None, False) system.db.refresh(event.source.parent.parent.getComponent('Power Table'),"data") system.util.invokeLater(printlabel, 500)