Custom Report AdvancedGET HELPThis document describes advanced custom reporting subjects and will be updated as new topics are addressed. If you can’t find what you’re looking for here, please post a question to the Reports section of the D-Tools Forum. Forcing subreports to filter differently Changing subtotals on proposals Changing List Price to Installed Price Separating Accessory Prices from Parent Insert rtf File and Merge with Data Show/Hide a Section Based on a Value ActiveReports User GuideThe Report Designer and reporting engine are based on ActiveReports from DataDynamics. For this reason, it is recommended that you take a look at the Active Reports Users Guide to understand the basic concepts behind custom reports. SubreportsSubreport basicsSubreports are reports that are called from another report and can be used to display data differently than on the main report. Two examples of this are the Miscellaneous Costs and Project Summary subreports, which are included in Proposals. SEE THIS VIDEO to learn the basics about subreports and see an example of how to modify the Tax Summary subreport included on Proposals. Resorting items in subreportsBy default, subreports inherit the sorting and grouping characteristics of the parent report. Creating a subreport that sorts data differently requires the use of scripting. Click here to read a forum posting that describes how to do this. Forcing subreports to filter differentlyBy default, subreports will inherit the data filtering from the parent report. Changing this requires the use of scripting. Click here to read a forum posting that describes how to do this. Passing values to subreportsGenerally, subreports are not aware of parameter values in parent reports. To pass a value from the parent report to a subreport requires the use of scripting. Click here to read a forum posting that describes how to do this. Modifying the Project SummaryThe project summary is a subreport that appears at the end of proposals, showing the grand totals for the project. While the basic mechanics for modifying this are the same as any other subreport, we have created additional documentation to show how to modify this particular report. Comment: although these examples all use scripting to accomplish special effects, scripting is not required to modify the project summary in general. Click here to see the basic steps with an example Click here to see how to show installation price only and hide labor Click here to see how to show only one line item for labor ScriptingScripting is used to take programmatic control of your reports. Although D-Tools standard reports are written using VB.Net, it is possible to create reports based on any of these languages: · VB.Net · C# To change the scripting language for a given report, go to the Report Explorer, select Parameters, and set the ScriptLanguage accordingly. To modify or begin creating script for a given report, click on the Script tab of the report at the bottom of the Report Designer window. Once in the scripting tab, you can take control of the objects on your report by using the scripting language of your choice. The Active Reports User Guide and the Report Utilities API provide additional information about how to do this. Report UtilitiesD-Tools has created a variety of helper objects and functions which make the manipulation of reports easier, and you will see these used throughout the standard reports. Collectively these are called Report Utilities. Please see the Report Utilities API for more information on these classes and how to use them. Click here to see a forum posting about the API document itself and Report Utilities in general. Adding Data FieldsIt is possible to add additional data fields to any custom report. To do this: 1. go to the Data Explorer tab in the Report Designer 2. expand the Bound XML Data tab 3. expand the dtr:DToolsReport node 4. expand the dtr:Project node 5. drag and drop the appropriate data field onto the report. This will create a textbox which is bound to this data field. Tip: You may need to expand a node further to see all the data. For example, data fields for individual items in the project (price, description, etc) can be found in the dtr:Items/dtr:Item node. Reporting XML structureThe D-Tools SI5 reporting XML structure is defined here: http://www.d-tools.com/schemas/si5/reports/dtoolsreport.xsd Calculated ValuesUsing scripting, it is possible to show a calculated value on a report (for example, show the unit price based on quantity and total price). Click here to download basic instructions with a sample report Click here to see how to create a calculated field based on the grand total of a project Click here to see a forum posting including a detailed discussion of calculated values Click here for yet another forum posting discussing calculated values that other users have found useful Iterating over dataEach report contains a Details section that tells the report which data field to iterate over, and what to show for each individual item found therein. For example, proposals iterate over the dtr:ProposalItems field, which means the detail section will repeat for each dtr:ProposalItem found. To change the data that the report iterates over, double-click on the database icon in the Detail1 header. This opens the Datasource dialog. Change the data to be iterated over by changing the Recordset Pattern to the XML path of the data field you wish to use. Do not change the File URL. Grouping and SubtotalsGroupings are used to organize and subtotal the items displayed on a report. You can insert your own groupings by following these steps: 1. Right-click on the design pane and select Insert > Group Header/Footer 2. Highlight the GroupHeader row, go to Properties and set the Data Field property to the data field you wish to group by. For example, you could group by dtr:Location, dtr:Zone, or dtr:Phase. To add a subtotal to a group header or footer, follow these steps: 1. Drag the data field you wish to subtotal from the Data Explorer to the header or footer section (or add a textbox control and set the DataField property to the desired field). 2. Select the resulting textbox, go to Properties, and set: a. SummaryFunc = Sum b. SummaryGroup = name of group header section c. SummaryRunning = none d. SummaryType = subtotal Note that these can be changed to achieve different effects. See the Active Reports User Guide for more information. Click here to learn more about changing the way items aggregate and group. Changing subtotals on proposalsClick here to see an example of how to modify the subtotals on proposals to show both labor and equipment subtotals separately. Dynamic groupingsIn order to make changing groupings possible without creating a custom report, most standard reports make use of dynamic groupings. Dynamic groupings determine the field to group by at run time based on the report definition. When modifying a standard report, you can identify dynamic groupings by their names, which must be literal for them to work. These include: GrpDynamicHeader1, GrpDynamicHeader2, and GrpDynamicHeader3 with associated footers (GrpDynamicFooter1, etc). This is discussed in more detail here. The name of the current header field is stored in a textbox named txtDynamicHeader1 (2, or 3). So, for example, if the grouping is location, this textbox will contain the name of the specific location. You can add a textbox with this name to your report to display the value of the group. Not all reports make use of all 3 dynamic headers. To add one, add a grouping and set the name of this group to one of the names above (e.g. GrpDynamicHeader3). See this forum posting for a little more information. To remove the dynamic functionality of a grouping, the easiest way is to: 1) rename the grouping header, and 2) set the Data Field property of the grouping header to the field that you wish to group by. Custom SortingOccasionally, the sorting options in the report definitions do not accomplish the desired results due to the way the report is grouped. Sorting proposals by priceThe best example of this is sorting proposals by price, to show the most expensive items first within each group. SEE THIS VIDEO to see how to create a custom proposal that sorts items by price, and this forum thread for more information. Page BreaksPage breaks are controlled by the GroupKeepTogether, KeepTogether, and NewPage parameters for individual header rows. To change these, highlight the header row and modify these in the parameters window. Page Size and MarginsCustom Page SizeIt is possible to take programmatic control of your page size and set it to any value you wish. Click here to see a forum posting which discusses this. Note: If you are using a standard page size, you do not need to do this, but rather would set the page size in the D-Tools Report Information. Changing MarginsChanging margins or paper sizes requires the user to create a custom report. CLICK HERE to see a help video showing you how to accomplish this. Gutter MarginsClick here to read a forum posting about gutter margins. Combining ReportsIt is possible to combine a number of different reports into a single report, which maintains page numbers for the whole (as opposed to Report Groups which number reports individually). Click here to see how to do this. Adding Product ImagesClick here to see how to add product images to a report that does not have them, such as the Line Item report. Changing List Price to Installed PriceClick here to see how to change a list price report to an installed price report. Separating Accessory Prices from ParentOn proposals, accessory prices are normally included in the price of the parent item. Click here to see how to separate them, or click here to download a document with sample report. Insert rtf File and Merge with DataThrough the use of scripting, it is possible to create a rich text control that includes references to D-Tools data. Click here to learn more about this. Client Address TextboxThe client address textbox is different from other textbox controls, in that the value is set by scripting rather than by binding directly to data. Click here to learn more about how to use and modify the client address. Show/Hide a Section Based on a ValueClick here to see an example of how to show or hide a section based on a value. |