Database Publishing with Developer Studio Kathy Kendall Information Builders Information Builders Summit 2009 User Conference June 2009 Author: Kathy Kendall Company: Information Builders Presentation Title: Database Publishing with Developer Studio Presentation Abstract: A growing number of companies are leveraging the power of databasedriven publishing to merge information extracted from diverse data sources with high-end document design tools to produce personalized communications to key customers, stakeholders, and management. These companies are looking to create stylized documents that contain variable content based on a specific customer, product or set of business rules. The key is to automate the production of these materials by merging page layout design of recurring content and style elements with variable data from a variety of select data sources. In this lab you will learn how to use the latest enhancements within the Document Composer to produce unique and relevant PDF documents with communications customized to each member of your target audience. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 1 of 40 Business Need: In this lab you will learn how to build stylized personalized PDF statements containing custom information for each customer. The document you will be building is Innovative Investments’ Quarterly Customer Investment Statement, providing each customer with key account summary and transactional information. Compound reports let you combine different views of your data for clearer and more creative ways to communicate your message. Coordinated reports allow you to produce individual versions of your message personalized to each member of your target audience. With Coordinated Compound Reports you can combine these powerful tools to build PDF documents containing multiple reports and graphs and generate instances customized with the information relevant to each unique value of your primary sort key. These documents can be printed or distributed electronically as an individual PDF documents using Report Caster. The individual component reports and graphs have been produced by a separate development team using a variety of techniques that we will identify as we walk through the process of bringing it all together into a coordinated compound document. You have also been provided with the images and the text you will use to style the document. As the designer, it is your responsibility to bring all of this information together and create a professional and appealing statement for distribution both electronically and in print. Your final results will be a PDF document that looks similar to the screenshots below: Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 2 of 40 Step 1 – Create New PDF Layout Document 1) From the desktop start the reporting server and Developer Studio. a) Start the WebFOCUS Full Service 769 reporting server. b) Start Developer Studio. 2) Create new procedure within the DBPublishing application directory in Projects on localhost. a) Right mouse click on Procedures folder and select New / Procedure. b) Define the procedure: i) Name your procedure STMT_CMPD. ii) Select to create with the Composer (Layout). iii) Click on Open. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 3 of 40 The Document Composer will open displaying your new document with one blank page layout. 3) Setup the Compound Document properties within the Properties panel on the right. a) Set Coordinate Report On. b) Set Page Orientation to Landscape. c) Set Reset Page Number On to have the page numbers restart with each new coordinated key value. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 4 of 40 You will see the page orientation shift to landscape on the Page Layout presented. Step 2 – Define document styling We will begin by defining the Page Master with the formatting we want common to all pages within our document. Images, lines and text can be placed on the Page Master to create a common look throughout your document. 1) Add a Page Master. a) Click on the arrow next to the New Page Layout icon in the toolbar to open the options. b) Select Add Page Master Layout. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 5 of 40 Page Master will be added at the top of the document and your positioning will be moved to the top. This Page Master will always display as the first page of your document in design view. It does not display in our output document. 2) Add the company logo image. a) Click on the Image icon in the toolbar and use the hairline pointer to draw a box on the page in the top left corner where the image should be placed. b) Select InnovativeInvestments.jpg as the source image. c) Use your mouse pointer or the arrow keys on the keyboard to move the image to the edge of the top left margin lines indicated on the page. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 6 of 40 3) Add a vertical line for styling a) Click on the Line icon in the toolbar and use the hairline pointer to draw a vertical line on the page starting next to the logo image and running down to the bottom margin guide line. Depending on your screen resolution you may not be able to size the line to cover the full page in one motion. If necessary, scroll down so you can see the bottom of the page and use the sizing controls on the line to expand the length of the line to the bottom margin. b) Set the color for the line to match the color scheme of the logo. i) Click on the line you to select it on the page and to display attributes for this object in the Properties panel. ii) Click in the Color attributes cell. You can use the selection dialogue to pick a color from the existing options but for our purposes we will designate a specific rgb color value to match our logo. iii) Double click to open the attribute cell for edit and enter : rgb(200,208,218) Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 7 of 40 c) Position the line: scroll to the top of the page and use your mouse or the arrow keys on the keyboard to make sure that the line is positioned directly adjacent to the logo image. 4) Add the company address below the logo. a) Click on the Text Icon to add a text object to the page and use the hairline pointer to draw a text element below the logo image. b) Double click on the text object to open for text edit. Notice the frame of the object will change from to a hatched box to indicate edit mode. c) Enter the following company address text into the text element: Two Penn Plaza, 31st Floor New York, NY 10121-2898 (800) 555-9898 d) Click outside the text element to close edit mode. e) Apply Font Styling. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 8 of 40 i) Click on the text element to select for styling. ii) Click on the Font Style icon in the toolbar to apply styling. iii) Set the text styling. Font = Tahoma (Tip: In the font text edit box type “T” to move quickly through the available font list alphabetically.) Style = Bold Size = 8pt Color = Navy f) Center the text: With the text object is still selected Click the Align Center icon on the toolbar. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 9 of 40 g) Superscript the “st” in 31st . i) Double click on the text element to reopen for editing and select ‘st’ in the first address line. ii) Click on the Superscript icon on the formatting toolbar. 5) Add the page numbers. a) If necessary, scroll down to display the bottom right corner of the Page Master. b) Click on the Text Icon and use the hairline pointer to draw a text element in the bottom right corner of the page. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 10 of 40 c) Double click on the new text element to open for edit mode. d) Right mouse click within the text element to select from the context menu options. Select Insert / Page n of n. e) Click outside the text element to leave edit mode and then click on the text element to select for styling. f) Set the text styling. i) Click on the Font Style icon in the toolbar. ii) Set the following font attributes. Font = Tahoma Style = Bold Size = 9pt (Notice that you can set sizes other than those provided in the list by typing your desired size in the Size edit box. Color = Navy Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 11 of 40 g) Set text element alignment - Click on the Align Right icon in the toolbar. h) Click on the Refresh Icon on the toolbar to display the updated Page Master styling on the existing Page Layouts. i) Scroll down to display Page Layout 1 and see how the Page Master styling is applied to the page. Step 3 – Create Account Summary Page The Account Summary page contains 3 reports, a graph and page specific text elements. We will add each of these to Page Layout 1. 1) Add the account header. a) Click on the Report Icon on the toolbar and use the hairline pointer to draw the report component on the top of the page, next to the logo image. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 12 of 40 b) Right mouse click on the report component and select to Import Existing Procedure. c) Select to Open STMT_ACCTHDR.FEX. The report will be displayed in preview with simulated data. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 13 of 40 d) Let’s look at the report we have imported. (Optional) i) Double click on the report component to open the report. The imported report will open in the procedure viewer. ii) Double click on the report component to view the report we have imported. Key Component Characteristics: CUSTOMERID is the top level BY field with visibility turned off (NOPRINT). This is a detailed level report with account information presented within the Page Heading. A new page will be generated for each CUSTOMERID value within the coordinated output. Page Margins are all set to 0.00 within Report Options / Format. iii) Close the Report Painter and close the Procedure Viewer to return to the Document Composer. e) Position the account header report on the page using any of the following options: Drag using your mouse. Move using the arrow keys on your keyboard. Set the Position and Size attributions within the Properties panel. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 14 of 40 f) Run the report. i) Use the Two-Page tool in Acrobat Reader to view your pages two up. ii) Scroll through the PDF and notice: You have a separate page for each of the six customers in our current data file. Page numbering starts over for each customer. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 15 of 40 g) Close the output window and return to the Document Composer. 2) Add the Account Overview a) Click on the Report Icon on the toolbar and use the hairline pointer to draw the report component in the top right corner of the page. b) Right mouse click on the report component and select to Import Existing Procedure. c) Open STMT_ACCOVERVIEW.FEX. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 16 of 40 The report will be displayed in preview with simulated data. d) Let’s take a look at the report we’ve included. (Optional) i) Double click on the report component to view the report we have imported. This fex creates a series of virtual fields within the DEFINE component and aggregates the summary data within the report component. ii) Double click on the report component to view the report. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 17 of 40 Key Component Characteristics: CUSTOMERID is designated as the top level BY field with visibility turned off (NOPRINT). This is a summary level report with account information is presented within the CUSTOMERID SubFooting. This allows the report to display aggregated totals for each coordinated key. To correctly display within a coordinated compound report make sure to build summary reports at the subfooting not the report footing level. An Alignment Grid was used within the Subfooting to facilitate a table type presentation of the formatted data. Page Margins are all set to 0.00 (within Report Options / Format). iii) Close the Report Painter and close the Procedure Viewer to return to the Document Composer. e) Position the account header report on the page. Use the keyboard mouse keys to move objects outside of the margin guides. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 18 of 40 f) Run the report. i) Scroll through the report to the pages for each of the six customers in your data. ii) Use the Two-Page tool in Acrobat Reader to view your pages two up. iii) Close the output window and return to the Document Composer. 3) Add the Investment Allocation Pie. a) Click on the Graph Icon on the toolbar and use the hairline pointer to draw the graph component on the bottom of the page. It is ok to cover the page number from the page master – it will show through the background of the graph. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 19 of 40 b) Right mouse click on the graph component and Include Existing Graph. c) Open STMT_ALLOCPIE.FEX. Key Component Characteristics Presents the actual summary values in the legends. This is accomplished by building an aggregated hold file with a computed field that concatenates the product type label and with associated the summary value. This new concatenated field then is used as the dimension field within the graph. COMPUTE SHOWREVENUE2/A100 = LJUST(20, STMT_TRANS.SEG01.PRODUCT_TYPE, 'A20') | RJUST(15, FTOA(CQ_CLOSE, '(D10.2M)', 'A15'), 'A15'); Advanced Graph Assist is used to graph the resulting hold file. CustomerID is defined as the Multigraph key and serves as the coordinated key. Output parameters are set as: output format to SVG, output type to File, and the hold file name contains four characters or less. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 20 of 40 d) Position the graph component on the page . e) Run the report and scroll through the output to see the first page for each of the customers in your data. 4) Add Page Specific Styling Elements. a) Add the first text element. You cannot import third party documents into this document but you can cut and paste the text. To ease your development you can find the text to be included in the current application directory. You can access this file by returning to the Explorer Window. i) Copy the text to be inserted: Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 21 of 40 (1) Select Window / Exploring - Developer Studio/ Projects on localhost/DBPublishing/Procedures (2) Locate CUSTOMERSUPPORT.TXT in the Other folder of the DBPublishing Application Directory. Right mouse click and select Open in Text Editor. (3) Select the first line of text to copy. Type either CTRL-C or from the menu select Edit -> Copy to place this text in your copy buffer. (4) Use the Window Menu to return to Document Composer stmt_cmpd. ii) Add a text element for the Account Summary paragraph within the left margin. iii) Double click to open the text element for edit and type the text below or paste the text you have in your copy buffer by either typing CTRL-C or Right-mouse click / Paste. The Account Information section provides an overview of activity in your account during the statement period. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 22 of 40 iv) Apply the following Font Styling to the entire text element. (1) Select text element for styling. Click outside of text element to exit edit mode then click on it again to select. (2) Set the styling as Font = Tahoma Size = 9pt Color = Navy Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 23 of 40 v) Apply bold formatting to select words. (1) Click in the text element to open again. (2) Select the words “Account Information” . (3) Click on the Bold icon to apply bold styling to selected characters. vi) Click outside the text element to exit edit mode. vii) Size and position the text element so that it lines up below the under the address block. b) Add the second text element. i) Add another text element in the left margin below the Account Information blurb. ii) Insert the following text: (either type the text below or cut / paste from the 2 nd line of text within in CUSTOMERSUPPORT.TXT) The pie chart in the Investment Allocation of Your Account Balance section illustrates the allocation of your account among the available investment options as of start of business the 1st day of the next statement period. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 24 of 40 iii) Select the text and apply styling Font = Tahoma Style = Normal Size = 9pt Color = Navy iv) Bold the words “Investment Allocation of Your Account Balance”. v) Superscript the ‘st’ in 1st towards the end of the text. c) Add the Web Link Report. i) Add a new report object to the bottom corner of the page within the left margin. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 25 of 40 ii) Import the existing procedure: STMT_LINK.FEX. Key Component Characteristics: CUSTOMERID is the top level BY field with visibility turned off (NOPRINT). The hyperlink has been added as a DrillDown to an external url in the CustomerID Subfoot. iii) Size and position the new report to display within the bottom left margin: iv) Run to see the completed Account Summary page: (1) Scroll through each of the pages and see how they differ for each customer. (2) Hover over the hyperlink we have added in the left margin and see where it will take you. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 26 of 40 Step 4 – Create Account Activity Page The Activity Pages will contain the following components: Page Header Report (STMT_HEADER.FEX) Key Component Characteristics: CUSTOMERID is the top level BY field with visibility turned off (NOPRINT). Places information to be right justified on the report into the Page Header. Places information to be left justified below the Page Header into the subheading for the coordinated key. Transaction Reports In this layout we will be using three identical transaction reports differentiated only by the selection criteria (WHERE Clause). STMT_TRANS1.FEX – for Product = Brokered Funds STMT_TRANS2.FEX – for Product = Mutual Funds IDS STMT_TRANS3.FEX – for Product = Banking Key Component Characteristics: CUSTOMERID is the top level BY field with visibility turned off (NOPRINT). Totals are subtotals not report totals so that they are calculated for each value of the coordinated key. Column width for Product Name column was set to truncate at 2” so that the columns sizes would remain constant even though values vary in length across the different Product Categories. 1) Add the new Page Layout. a) Click on the New Page Layout icon to add a new Page Layout. b) Click on the Refresh icon to apply the Page Master styling to the new page layout. c) Scroll down the document to see the new Page Layout. 2) Add the page header report component a) Add new report component to the top of the page and Import the existing procedure: STMT_HEADER.FEX. b) Size and position the header report as shown below. Remember you can use the arrow keys on the keyboard to move selected objects outside the page margin guides. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 27 of 40 c) Run the report to see the new page with the custom page header in place. 3) Add the transaction reports. a) Place 3 report components on the page. Do not worry about sizing them. We will use the sizing and alignment tools to get things in place. Be sure that none of the reports are overlapping at this point so that we can define relationships between them. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 28 of 40 b) Import each to one of the transaction reports to one of the report components. i) Import STMT_TRANS1.FEX to the top report ii) Import STMT_TRANS2.FEX to the middle report iii) Import STMT_TRANS3.FEX to the bottom report Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 29 of 40 c) Define the flow styles and relationships between each of the reports. We will anchor the top of the page with the header report as a fixed report that will always present in the designated vertical size. Each of the transaction reports will be defined as flowing reports related to the report above it. o Flowing reports automatically size to fit the number of transactions for the current coordinated key. o By setting a relationship between each transaction report and the report just above it, we can designate that the subsequent report should not begin until the first report is complete. Additionally if any of the transaction reports are empty the subsequent report will float up on the page and present in its place. We will start by relating each report to the one above it. Think of it as relate this to that. First select this then select that. i) Relate Transaction Report 1 to Header (1) Click on Report 1 (2) CTRL-Click on the Header report (3) Click on the Relate Bottom_Left icon The relationship will be represented by an arrowed line between the two components. ii) Relate Transaction Report 2 to Transaction Report 1 (1) Click on Report 2 (2) CTRL-Click on the Report 1 (3) Click on the Relate Bottom_Left icon Each new relationship will be represented by an arrow between the reports. iii) Relate Transaction Report 2 to Transaction Report 3 (1) Click on Report 3 (2) CTRL-Click on the Report 2 (3) Click on the Relate Bottom_Left icon Each new relationship will be represented by an arrow between the reports. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 30 of 40 d) Size and position the reports. i) Size the first transaction report as shown below: ii) We will now use this as our guide to size and align the other reports. Select all three transaction reports as follows. It is important to select these reports in the correct order. We want to select the target report then the source report. Think – relate first selected to second selected. (1) CTRL-Click on the 3rd report (2) CTRL-Click on 2nd report (3) CTRL-Click on 1st report iii) We will now use the position toolbar to make these reports the same shape and size. (1) Click on the Align Left icon (2) Click on the Make Same Size icon Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 31 of 40 e) Modify component attributes within the properties panel. While we have all three selected we can take advantage of the multiple setting capabilities to set common attributes for each report. i) Set Size and Overflow to Flowing. ii) Set Sizing Requirement to 2. iii) Click off the report components to deselect. Click on each to see that the settings have been updated. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 32 of 40 f) Move Report2 and Report3 so that the subsequent report slightly overlaps the preceding report as shown below: g) Run the report to see what you have built and how the transactional reports flow. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 33 of 40 Notice that for each customer, each of the transaction reports presents the available records and then is followed by the next transaction type report. If the flowing reports expand past a single page, an overflow page is generated. Notice what happens when a customer does not have a certain type of transaction. Step 5 – Add Account Activity Overflow Page We will now work on formatting the overflow page by setting flow margins and a different header to distinguish overflow from the first page. 1) Define Page Layout Flow Margins The Flow Margins define the bottom margin of the page for the flowing reports and the top margin of the overflow page where the overflow reports will begin. a) Click anywhere on Page Layout 3 (the activity page) to select the page and display the page parameters. b) Within the parameters panel set the Flow margin: bottom to 1 Flow margin: top to 1.25 2) Add a new overflow page to define different header / footer. a) From New Page Layout icon select Add New Overflow Page. b) Click on the Refresh Icon to apply Page Master styling to the new overflow page. c) Scroll down below Page Layout 3 to see the new Overflow Page. Notice the page is labeled as an overflow object. The page is presented grey to designate that only components (reports or graphs) can be inserted on this page. The second set of margin guides now displayed within the outer margin guides represent the flow margins we defined above. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 34 of 40 3) Add the overflow page header report. a) Right click on the page and select New Report from the context menu. b) Your mouse pointer will become the hairline pointer. Use the hairline pointer to draw a new report object at the top of the page. c) Position the new report in the same location as we put the header on the first page layout. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 35 of 40 d) Import the report: STMT_HEADEROVERFLOW.FEX This report is identical to the header report placed on the first page except that that the Account Activity subheading has been changed to Activity Continued to clearly distinguish that this is a continuation page. e) Run the report to see how the overflow pages now have different headers. Step 6 – Complete Styling of Account Activity Page (Optional) Finish off the activity pages by adding the text element to the left margin to be displayed on the first page of the activities section. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 36 of 40 1) Scroll back to see Page Layout 3. 2) Add a Text element under the address block in the top portion of the left margin. 3) Insert the following text: (3rd line of text in CUSTOMERSUPPORT.TXT) The Account Activity section provides details of the activity in your account during the statement period. This statement has been carefully prepared to ensure that it is accurate and up-to-date. 4) Format the text as you did with the text boxes in the left margin on the first page: a) Set Font Styling Font = Tahoma Style = Normal Size = 9pt Color = Navy b) Make the words “Account Activity” bold Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 37 of 40 i) Run to see the final version of the Account Summary and Activity pages in your statement. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 38 of 40 Step 7 – Add a Closing Page Containing Previously Created Content Add final page of content from an existing page layout. 1) From the Add New Page Layout icon, click on the drop down and select to Add Existing Page Layout. a) Select STMT_CMPD_CLOSING.FEX. 2) Scroll down to see Page Layout 5 that has been added. Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 39 of 40 3) Run to see your final output and scroll through the overall document to see how each report is personalized based on the information we know about each individual customer: Congratulations! You are done!! Database Publishing with Developer Studio Copyright © 2009 Information Builders Page 40 of 40