Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
  • Welcome
  • Products
  • Support
  • About
  • More
  • Cancel
OpenUtilities
  • Product Communities
  • More
OpenUtilities
OpenUtilities Wiki Replacing caret characters on reports
    • 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. 

    Replacing caret characters on reports

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

    Background

    The caret character (^) can be entered in various text fields on dialogs in the software to indicate a line break. When the text is displayed on the project page drawing, a line feed / new line is inserted in place of the caret character.

    However, this functionality of the caret is not recognized by report templates. Therefore, in Run Reports, some template types include a Replace multi-line character(^) with space check box in Options. If this check box is set, the caret will be replaced with a space on the report output. If it is not set, the caret will be left as is. In neither case will the out-of-the box software replace the caret with a new line.

    Some report templates, like the Page List templates, do not have a Replace multi-line character(^) with space option.

    This article demonstrates how to replace the caret character by adding a script to the report template. With the script, the caret character can be replaced with a space, which removes it like the Replace multi-line character(^) with space BOM report option, or with a line break.

    The concept can be applied to other reports: the Replace instruction in the script can be used to remove or replace other characters or entire character strings.

    Steps to Accomplish

    Page List report templates

    1. Open a page of a project in which the value for the first page description includes the caret character for at least one page. This will allow the report template to be tested with a good example.
    2. Open Report Template Designer.
    3. Select File > Open and open the "Page List - Drawing (inch)" report template.
    4. In the Designer view, find the cell on the template that contains the [Page.Fields.Description 001] variable.
    5. Refer to the BeforePrint script article to unbind the variable from the cell and access the Before Print script.
    6. Paste the following before the "private void xrTable..." line of the Before Print script.
      using System.Data;
    7. Paste the following within the curly brackets { } of the script to replace the caret with a space:
        string ds = "", pg = "", pgdesc1 = "", pgdesc2 = "";
        ds = (string)GetCurrentColumnValue("DrawingSet");
        pg = (string)GetCurrentColumnValue("Page");
        DataSet dataSet1 = eCTReportTemplate1.DataSource as DataSet;
        DataRow[] dr = dataSet1.Tables["Page Fields"].Select("DrawingSet='"+ds+"' and Page='"+pg+"'");
        pgdesc1 = dr[0]["Description 001"].ToString();
        pgdesc1 = pgdesc1.Replace("^", " ");
        (sender as XRLabel).Text = pgdesc1;

      Alternatively, paste the following within the curly brackets { } of the script to insert a line feed in place of the caret:

        string ds = "", pg = "", pgdesc1 = "", pgdesc2 = "";
        ds = (string)GetCurrentColumnValue("DrawingSet");    
        pg = (string)GetCurrentColumnValue("Page"); 
        DataSet dataSet1 = eCTReportTemplate1.DataSource as DataSet;
        DataRow[] dr = dataSet1.Tables["Page Fields"].Select("DrawingSet='"+ds+"' and Page='"+pg+"'"); 
        pgdesc1 = dr[0]["Description 001"].ToString();
        pgdesc1 = pgdesc1.Replace("^", "\r\n"); // for this line to work, Multiline cell property must be Yes
        (sender as XRLabel).Text = pgdesc1;
      

      Be sure to select the cell bound to the new script and go to the Property Grid, then set the Multiline property to "Yes". In recent versions, the Multiline property is in the Behavior category.

    8. The script should look something like the following when finished:
      using System.Data;
      private void xrTableCell20_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
        string ds = "", pg = "", pgdesc1 = "", pgdesc2 = "";
        ds = (string)GetCurrentColumnValue("DrawingSet");    
        pg = (string)GetCurrentColumnValue("Page"); 
        DataSet dataSet1 = eCTReportTemplate1.DataSource as DataSet;
        DataRow[] dr = dataSet1.Tables["Page Fields"].Select("DrawingSet='"+ds+"' and Page='"+pg+"'"); 
        pgdesc1 = dr[0]["Description 001"].ToString();
        pgdesc1 = pgdesc1.Replace("^", " "); 
        (sender as XRLabel).Text = pgdesc1;
      }
    9. Select the Preview tab to preview the report.
    10. Select File > Save As and save the template to a new name.

    BOM templates

    To replace the caret character with a space

    1. Open Run Reports.
    2. Select the desired BOM report template.
    3. Click the Options button and set the Replace multi-line character(^) with space check box.
    4. Preview or Run the report.

    To insert a new line in place of the caret character

    1. Open a page of a project that contains part numbers with carets (^) in their descriptions.
    2. Open Report Template Designer.
    3. Select File > Open and open the "Page List - Drawing (inch)" report template.
    4. In the Designer view, find the cell on the template that contains the [Detailed_Description1] variable.
    5. Refer to the BeforePrint script article to unbind the variable from the cell and access the Before Print script.
    6. Paste the following within the curly brackets { } of the new script
          string descr1 = "";
          if (GetCurrentColumnValue("Detailed_Description1") != DBNull.Value)
          {
              descr1 = (string)GetCurrentColumnValue("Detailed_Description1");
              descr1 = descr1.Replace("^", "\r\n"); 
          }
          (sender as XRLabel).Text = descr1;
      

      Be sure to select the cell bound to the new script and go to the Property Grid, then set the Multiline property to "Yes". In recent versions, the Multiline property is in the Behavior category.
    7. Select File > Save As and save the template to a new name.
    8. Close Report Template Designer.
    9. Open Run Reports.
    10. Select the new report template.
    11. Click the Options button and clear the Replace multi-line character(^) with space check box.
    12. Preview or Run the report.

      Original Author:  Matt_P
    • CONNECT Edition
    • Template Management
    • v8i
    • promis.e
    • how to
    • Report Template Designer
    • Customization
    • Bentley Substation
    • en
    • Share
    • History
    • More
    • Cancel
    • Matt_P Created by Communities MVP Matt_P
    • When: Mon, Mar 30 2015 12:57 PM
    • Siddharaj Talawar Last revision by Bentley Colleague Siddharaj Talawar
    • When: Fri, Apr 3 2020 9:50 AM
    • Revisions: 7
    • 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