Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
  • Welcome
  • Products
  • Support
  • About
  • More
  • Cancel
OpenUtilities
  • Product Communities
  • More
OpenUtilities
OpenUtilities Wiki Add leading zeros to numbers 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. 

    Add leading zeros to numbers on reports

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

    Background

    This document describes how to force numbers to be displayed as a specified number of digits on a report by using a script in the report template. The script adds the necessary amount of leading zeros to the numbers.

    Steps to Accomplish

    Copy the following script and paste it as the contents of the BeforePrint script for the table cell or label that displays the number:


    int number;
    string value = (sender as XRLabel).Text;

    bool result = Int32.TryParse(value, out number);
    if (result)
    {
       (sender as XRLabel).Text = number.ToString("D3");
    }
    else
    {
       (sender as XRLabel).Text = value;
    }


    Notes:

    The "D3" argument in the script sets the number of digits to 3.  Change the 3 to the desired number of digits.

    If the number is not an integer value it will be displayed in its original format.

    External Links

    How to: Pad a Number with Leading Zeros

      Original Author: John Spathaky

    Keywords: text on drawing, losing, drop, wire number, page number
    P/S: 68481, 500000086444

    • Template Management
    • promis.e
    • Migrated
    • how to
    • Report Template Designer
    • Bentley Substation
    • en
    • SELECTsupport
    • Share
    • History
    • More
    • Cancel
    • JohnS Created by JohnS
    • When: Wed, Jun 11 2014 9:44 AM
    • Satish Saptasagar Last revision by Bentley Colleague Satish Saptasagar
    • When: Fri, Apr 3 2020 9:46 AM
    • Revisions: 5
    • 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