Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
  • Welcome
  • Products
  • Support
  • About
  • More
  • Cancel
OpenUtilities
  • Product Communities
  • More
OpenUtilities
OpenUtilities Wiki Before Print scripts for report templates
    • Sign in
    • +OpenUtilities
    • +Bentley sisHYD Multi Utility
    • Design Features - promis.e Functionality - Promis.e Standard
    • +OpenUtilities Substation
    • Promis.e Paths
    • -Promis.e Wiki
      • +CONNECT Edition - Promis.e
      • About Promis.e
      • +Administration Features - Promis.e
      • +APIs_VBA - Promis.e
      • +Automation Features - Promis.e
      • +Component Features - Promis.e
      • +Component Management - Promis.e
      • +CONNECT Services - Promis.e
      • +Data Manager - Promis.e
      • +Database Platform Support - Promis.e
      • +Display - Promis.e
      • +Drawing Management - Promis.e
      • +Engineering Design Considerations - Promis.e
      • Error - Object reference...General
      • +Find_Replace - Promis.e
      • Finding the Tutorial
      • +Installation_Configuration - Promis.e
      • +Interoperability - Promis.e
      • +Licensing - Promis.e
      • +Maintenance Features - Promis.e
      • +Migration - Promis.e
      • +OS Support - Promis.e
      • +Panel Layout - Promis.e
      • +Performance - Promis.e
      • +PowerPlatform Support - Promis.e
      • +Print_Publish Features - Promis.e
      • +ProjectWise Integration - Promis.e
      • Promis.e Help file
      • +Reports_Output Features - Promis.e
      • -Template Management - Promis.e
        • +Graphical Plan Template Designer - Template Management - Promis.e
        • -Report Template Designer - Template Management - Promis.e
          • Add leading zeros to numbers on reports
          • Before Print scripts for report templates
          • Concatenating fields on report templates
          • Control number precision on reports
          • Desired Data Field Not Listed in Report Template Designer
          • Display current date and time on reports
          • Quantified BOM report with device IDs on a single line
          • Removing Terminal CP Text from Wire Lists
          • Replacing caret characters on reports
          • Report Page Number Format
          • Report Template Designer
          • Rounding up quantities on BOM reports
          • Sortable Quantified BOM Report
      • +Text Tools - Promis.e
      • Training FAQs
      • +Wire Numbering - Promis.e
      • +Wiring Features - Promis.e
      • +Project Management - Promis.e
      • Promis.e Title
      • Working from home with Promise.e
    • Replace Family - Find_Replace - Promis.e
    • SQL Server Login

     
     Questions about this article, topic, or product? Click here. 

    Before Print scripts for report templates

      Product(s): Promis.e, Bentley Substation
      Version(s): through 08.11.13.140
      Environment: N/A
      Area: Template Management
      Subarea: Report Template Designer

    Background

    Data can be read from the project database and displayed on reports by simply dragging a data field onto the report template in Report Template Designer.  It is possible to manipulate data from the database before it is displayed on the report by using scripts in Report Template Designer. Such BeforePrint scripts can "overwrite" the contents of the table cell or label they are applied to, even if a data field is bound to the cell or label. The scripts can perform other functions as well, such as tallying, without manipulating how the data in the cell appears. This document describes how to use BeforePrint scripts as a reference for other articles. See the articles listed in the See Also section for specific BeforePrint script examples.

    The script language specified for the template and the language used in the scripts must be the same. The language specified for the template can be found by looking in the Script Language field in the Property Grid immediately after opening the template or by right-clicking the root node in the Report Explorer tree and selecting Properties:

    Steps to Accomplish

    For SELECTseries 6 through 8

    1. Open a project page using Project Manager.

    2. Open Report Template Designer.

    3. Select File > Open and open the report template.

    4. In the Designer view (Designer tab along the bottom of the Report Template Designer), find the table cell or Label that the script is to affect.

    5. Right-click this cell or label and select Properties.

    6. On the resulting Property Grid view, expand the Scripts row.  The Scripts row is in the Behavior category.

    7. Click on the Before Print row.

    8. Click the down arrow button that appears in that row.

    9. Choose New from the drop-down list.  This will open the Scripts view and create a new function.
    10. Paste or compose the intended script within the curly brackets { } of the new function.  Be sure not to delete or overwrite the function declaration line (private void...{ ) and closing curly bracket.

      private void xrTableCell20_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
         // paste script here
      }

    11. Preview the report by clicking the Preview tab.

    12. If the results are acceptable, use File > Save to save the template or File > Save As to save it as a new template.

    13. Close the Report Template Designer.

    To modify an existing script, click the Scripts tab at the bottom of Report Template Designer and find the script.

    For SELECTseries 5 and earlier

    1. Open a project page using Project Manager.

    2. Open Report Template Designer.

    3. Select File > Open and open the report template.

    4. In the Designer view (Designer tab along the bottom of the Report Template Designer), find the table cell or Label that the script is to affect. Click this cell.

    5. Perform these steps only if the script will be populating the cell:
      1. With the cell selected, click the small > button that is revealed above the cell.

      2. On the resulting Table Cell Tasks dialog, clear the Text field and ensure the Data Binding field is set to "None".

      3. Click away from the Table Cell Tasks dialog to dismiss it. The cell selected in step 4 should now have no text in it.

    6.  Right-click this cell or label and select Properties.

    7. On the resulting Property Grid view, expand the Scripts row.

    8. Click on the OnBeforePrint row.

    9. Click the [...] button that appears in that row.  This will open a Script Editor dialog showing the current script for the OnBeforePrint event.

    10. Paste, compose, or modify the intended script within the curly brackets { } of the function. Be sure not to delete or overwrite the function declaration line (private void...{ ) and closing curly bracket.

      private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
         // paste script here
      }

    11. Preview the report by clicking the Preview tab.

    12. If the results are acceptable, use File > Save to save the template or File > Save As to save it as a new template.

    13. Close the Report Template Designer.

    To modify a script, repeat steps 4 through 7.

    To remove a script, repeat steps 4 through 7 and click the Default Script button on the Script Editor dialog.

    If the script seems unable to populate the cell or label, try unbinding the Field:

    1. With the cell selected, click the small > button that is revealed above the cell.

    2. On the resulting Table Cell Tasks dialog, clear the Text field and ensure the Data Binding field is set to "None".

    3. Click away from the Table Cell Tasks dialog to dismiss it. The cell selected in step 4 should now have no text in it.

    See Also

    Add leading zeros to numbers on reports

    Concatenating fields on report templates

    Quantified BOM report with device IDs on a single line

    Removing Terminal CP Text from Wire Lists

    Replacing caret characters on reports

    Rounding up quantities on BOM reports

    External Links

    Scripting Overview - DevExpress

      Original Author:  Matt_P
    • Template Management
    • promis.e
    • how to
    • Report Template Designer
    • Bentley Substation
    • en
    • Share
    • History
    • More
    • Cancel
    • Matt_P Created by Communities MVP Matt_P
    • When: Wed, Jun 11 2014 1:04 PM
    • Satish Saptasagar Last revision by Bentley Colleague Satish Saptasagar
    • When: Fri, Apr 3 2020 9:47 AM
    • Revisions: 14
    • Comments: 0
    Recommended
    Related
    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2021 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies