Question

Using Report Rules to Multiplex Reports?

  • 16 October 2020
  • 3 replies
  • 595 views

Userlevel 4
Badge +9

Has anyone ever use report rules to send output to multiple printers from one print job?

(Is this even possible?)

I’ve got a set of report rules to save Invoices as a PDF using IFS Connect but I also want to send a hard copy to specific printers depending upon certain data fields on the invoice.

There is a logical printer, ARCHIVER, that the user selects and then I have two rules, executed in the following order:

  1. If Logical Printer is ARCHIVER and certain Site code - Print To Logical Printer HARD_COPY
  2. If Logical Printer is ARCHIVER then Route to Connect

I can see both rules firing in the Print Rule Log,

Rule #1 sees an entry in the print agent log file but nothing is output

Rule #2 sees a file created via IFS Connect.

 

Any ideas?

 


3 replies

Userlevel 4
Badge +8

Dear @KIMKIMANDREW 

Based on our inputs, the following is my thoughts.

 

  1. Change the conditions to being mutually exclusive of each other. In this case Rule 1 should be for SITE CODE equals ( say A),  and Rule 2 Should be for Site Code Not Equals ( to A).
  2. Set Logical Printer Id = HARD_COPY .  I assume there is a physical printer named as HARD_COPY, installed on the a specific machine to receive these prints. There will be a necessity to   configure a print agent , to frequently check if any job is being sent to the Logical Printer, and to forward this to the printer , on that server/system, with the same name called HARD_COPY. The details of the config needed are in IFS technical documentation for reference. https://wit.ifsworld.com/f1docs/apps9/  -  
    Foundation1 / Installation Guide / Installation Options / Reporting / Install Print Agents /

Regards

Vivek

Userlevel 4
Badge +9

Thanks for the reply Vivek

Unfortunately, that would result in output going to EITHER connect OR HARD_COPY

I want an output to BOTH

 

 

Userlevel 6
Badge +15

You could do this with some custom code and using the PDF_REPORT_CREATED event to print a report out to a different printer.  (I use a similar solution to reprint an operational report using  different Crystal Layout and also email out the PDFs at the same time)

https://community.ifs.com/technology-infrastructure-cloud-integration-dev-tools-50/automate-purchase-order-pdf-email-590

https://community.ifs.com/technology-infrastructure-cloud-integration-dev-tools-50/batch-print-work-instructions-for-shop-orders-ifs9-286 - See last post

 

 

Or you could use PDF_REPORT_CREATED to handle the output to file instead of using Route to connect - here I have some code which is triggered when an invoice is printed to save a PDF copy to file.

 

declare

pdf_file utl_file.file_type;
Stor_buf_ raw(32000);
pdf_blob blob;
pdf_blob_len integer;
vstart number := 1;
addmax binary_integer := 32000;
result_key_ number;
x number;
l_filename_ varchar2(100);
ora_dir_ varchar2(1000) :='INVOICE';
invoice_no_ varchar2(2000);
customer_po_no_ varchar2(2000);
customer_no_ varchar2(2000);

begin


select pdf into pdf_blob from ifsapp.pdf_archive_tab a where a.id = ifsapp.pdf_archive_api.Get_Id(&RESULT_KEY,&PRINT_JOB_ID);

customer_no_ := REGEXP_SUBSTR('&NOTES', '\Customer No: ([^,]+)', 1,1,NULL,1);
invoice_no_ := REGEXP_SUBSTR('&NOTES', '\Invoice No: ([^,]+)', 1,1,NULL,1);
customer_po_no_ := ifsapp.customer_order_api.get_customer_po_no(REGEXP_SUBSTR('&NOTES', '\Order No: ([^,]+)', 1,1,NULL,1));



pdf_blob_len := dbms_lob.getlength(pdf_blob);

-- Open the destination files.

l_filename_ := '#DB_SID#' || ' - ' || invoice_no_ ||' - '|| replace(customer_po_no_,'/','') ||'.pdf';

pdf_file := utl_file.fopen(ora_dir_, l_filename_, 'wb', 32764);

vstart := 1;

-- Save blob length
x := pdf_blob_len;

-- If small enough for a single write
if pdf_blob_len < 32760 then
utl_file.put_raw(pdf_file, pdf_blob);
utl_file.fflush(pdf_file);
else
-- Doesn't fit, have to write it in pieces
vstart := 1;
while vstart < pdf_blob_len and addmax > 0 loop
dbms_lob.read(pdf_blob, addmax, vstart, Stor_buf_);

utl_file.put_raw(pdf_file, Stor_buf_);
utl_file.fflush(pdf_file);

-- Set the start position for the next cut
vstart := vstart + addmax;

-- Set the end position if less than 32000 bytes
x := x - addmax;
if x < 32000 then
addmax := x;
end if;
end loop;
end if;

-- Close the files.
utl_file.fclose(pdf_file);

end;

Note: I used the code found in this thread: https://community.ifs.com/people-human-capital-management-payroll-38/document-attachments-1806

Reply