Solved

Printing a report x times using a stored value.

  • 26 September 2022
  • 4 replies
  • 72 views

Userlevel 1
Badge +1

I want to print a report x number of times. This value x is stored in a column called ‘print_amount’. 

For example: 

The ‘print_amount’ column for record A is 5. This means that the report regarding this item must be printed 5 times. This value may change to 2 for record B, thus the next report must be printed 2 times.
I’ve added a report parameter called ‘print_amount’ and it’s linked to the stored value in column ‘print_amount’.

It works fine when I’ve enabled ‘Popup for each row’. The problem is that the user must confirm the printing of the report for each record. This is inconvenient.
When you disable ‘Popup for each row’ the first report parameter value is applied to every other following record (in the example above it’s 5). Therefore all reports are printed 5 times instead of their designated value in the stored column.

Is there a way to make it more convenient for the user while making sure that each record’s report parameter is used? 

icon

Best answer by Mark Jongeling 26 September 2022, 14:31

View original

This topic has been closed for comments

4 replies

Userlevel 7
Badge +23

Hi,

This is indeed a bit inconvenient as the settings are used for all selected rows if you don’t use the Popup for each row setting. However there are a couple of alternatives.

Since 2022.2 we support a new Print file process action which can Print reports and has an Input parameter for No. of copies. *Note that this is a System flow action only

Or; you can choose to use Multirow execution, where you can bundle the rows into one XML parameter, then run a process flow to loop through all names rows inside the XML parameter. then you can use the Start report process action and link the print_amount column with the Report parameter controlling the amount of copies. More on it here (also the replies contain good info): 

*Even though this is a Task to begin with, it's only a starting point for your process flow.

Hope this helps!

Userlevel 6
Badge +16

You can create a task as placeholder instead of printing the report you execute a task on the selected rows. The task fills a table with rows to print. Then in the decision node you select the first row to print and feed the information to the print report action, after printing you set the row to completed. When the loop has no more lines to print you exit the flow.

 

 

you could try using a cte for mutiple the records you need. Use this view in your report and you can print all stickers at once instead of printing each record x times

 

; with cte as (select id, 1 as [Value], quantity from tablename
                   union all
                   select id, [Value] + 1, quantity from cte where [Value] < quantity)

select * from cte 
 order by id, [Value]
 

Userlevel 1
Badge +1

Thank you all for replying!

I solved the problem using the XML method. All selected rows are bundled into one XML parameter and another task loops through the data. All ‘used’ records are removed and unused records are fed to the report. The loop ends when no unused data can be fed to the report.
No user input required and all reports are printed correctly. This method is ‘ok’ performance wise, but users may notice that the printing process takes a long time when printing lots of records.

The CTE method is actually much faster. I’ll look into this method in the future.