Wednesday 12 March 2014

Getting BI Publisher to print out multiple copies based on a value in the XML



I found a few pages with descriptions on how to do this but none were particularly clear so for the sake of my and Mikes Sanity ive made a simpler example using one of our reports 

 you put the whole template page inside a double for each loop like this  

the green highlighted bit is the full path to the xml field holding the number of copies  
(the +1 ive highlighted in yellow is in  there because the number of copies in the XML i was using  is set to zero its a number of ADDITIONAL copies field  hence the plus 1 :)  you wouldent normally need that bit   )  .  

and you need to add the second for each loop to say  go of and do everything on the report

<?for-each@section:xdoxslt:foreach_number($_XDOCTX,1,/R42530V/DETAIL_1_S4_Group/Total_1_S7/On_Ship_To_Connect_to_Level_Break_S5/NbrOfCopies_ID150 + 1,1)?> 

                 <?for-each:/R42530V?>
                         //  The rest of the Template goes in here //
                <?end for-each?>

<?end for-each?>

6 comments:

  1. How did you get the number of copies into the xml data?
    from the ube version?
    Thanks,

    ReplyDelete
    Replies
    1. Hi ekks7410 there are a few ways of doing it . the easiest we have found so far is to add a field to the UBE to hold the number of copy's the user requires and to populate that when the UE is generated . if you don't want the field to show on the UBE you can always set its visible property to false. then you can track down the field in the XML that holds the number of required copy's and grab it from there. I hope that helps answer your question. good luck with your BIP development and thank you for your question

      Charlie

      Delete
    2. I assume you mean hard code the number in the ube. Thanks for the response

      Delete
  2. Hi ekks7410, not quite hard coding but when the UBE is run , you can either pass in the number of copy's the user requires in an interconnect or as a processing option that way the user can chose any number when they run the report. the field then gets populated on the report at run time. I'm not a fan of hard coding when I can avoid it and if its posable to build in flexability for theusers id go with that every time

    ReplyDelete
  3. Excellent. Have a requirement where I need to print the page number on each of the copy. For example, if the num copies is 10, i need the page numbers from 1 to 10. I used below to initialize, increment and print but all pages print the same number. Please help.








    ///////template body////////


    ReplyDelete