Report Editing with Scripting

Hello There,

I am trying to print multiple copies of the report with one parameter change with below script -

Here the maxBobineNo = 5 let say,

but when the pdf is printed, all of them has the same value of parameter bobineNo.

any idea ?

event.source.parent.BobineNo += 1
name = 'Test Report ’ + str(event.source.parent.BobineNo)

I’d be curious where your running this script. I could be wrong but I would expect when you change the parameter that your report is going to have to run again. Your script though is going to fly through it and I wouldn’t expect it to wait for the report to finish updating. You may need to use instead.

Same result

Yes, but the issue is, runs on Gateway but the printer where the job needs to be printed would not be accessible from Gateway.
Perhaps just execute after every iterate would work (which don’t know if possible)

How about using It will return the bytes of the report, then you should be able to save it from there. I’d expect this to work with your system.file.writeFile() function.

1 Like

Yes, did that -

Worked fine.

Thanks so much @bpreston, @MMaynard

Just for in the future, one other idea that may of worked for you, the way you had it originally is utilizing the reportLoading function. If the report is printed each time you could also utilize this in a loop to allow you to use the print function to automatically print the report as it is run. An example of this is at the bottom of the report viewer page in the manual. Its labeled as utilizing reportLoading.

1 Like

I actually would have to use this because, with the way I did it before, it gives me the bytesArray for the file type I select which is okay for storing the data but with this, I can easily print to a label printer.

Thanks so much