When to use?
Jobs workflows allow you to combine content from different sources in runtime. You can run multiple reports from different report types and combine their content with some existing PDF or Excel files. The logic, which will decide which report or file to include is based on a simple YES/NO conditions.
Here is simple scenario: I want to print all customer invoices for the day, and because a new store was opened in zip 94114 I want to add a brochure with coupons, to the invoices for the customers in this area. I can add a step to append the PDF brochure to the document and assign a "Before" condition, which will check the currently processed customer zip code. If the zip code is 94114 the brochure will be added to the generated invoice otherwise the workflow will move to the next step (which might have a condition too). Here is a screenshot showing the workflow settings:
The workflow might be used in any case , which requires decision during runtime. For example you might use different versions of the same report based on customer language preference (English, Spanish, French ...), add waivers and welcome letters just for new customers etc. The advanced version of workflow will allow you to generate a file on the fly and append it or to add a file based on an expression (instead of hardcoded name). The final result will be one document , which will include the result from all processed steps. In the example above all customers from 94114 will receive one document containing an invoice and brochure, while the others will receive a document with invoice.
Of course you can resolve this task using subreports - add a subreport with an OLE object for the coupons and suppress it for all zips except 94114. You can also use some "magic" commands or formulas in your report , generate a PDF and then write an application, which will replace the "magic" content with a content from a specific PDF file. Here is the problem: when you add some additional logic to the report you will restrict your options to use it. In the example above the invoice report is designed just to print an invoice. Because this report is not doing anything else you can use it to print invoices in any scenario. The moment you add some logic to append coupons the report will be unuseful for all other scenarios because it will always
print invoices AND coupons and this might be not acceptable. The explanation is simple : by adding additional content to the report you are breaking the principle of Separation of concerns
. Invoice report handles concern to present invoice information the workflow will handle the concern to add coupons. If you need to handle another concern you might create another workflow and use the same invoice report. In case you add the coupons to the report you are mixing the 2 concerns ( invoice and coupons) and as a result there is no way to handle just the invoice concern.
The workflow solution wil allow you also to run multiple reports and combine them in one document. You can go even further and run reports from different types - for example Crystal report for the cover letter and SQL ad-hoc report to present the data as a pivot table. In such way you will be able to generate a cover page using pixel perfect Crystal report and to use much cleaner export to excel provided by SQL ad-hoc reports .