Code Count - Scans Libraries and Objects to Report Code Metrics
The Code Count utility is a small, single-window app that scans the objects in any or all of the libraries within a Workspace Target or Solution Project and produces reports which tell you several metrics about the source code, such as:
- The name of each object
- The date and time when each object was modified.
- The size of each object (as reported by PowerBuilder).
- The total number of source lines in each object, and a breakdown of lines of code, comment lines and empty lines.
- The number of events in each object.
- The number of functions in each object.
- The number of subroutines (functions that do not return a value) in each object.
- The number of external function declarations in each object.
- The descriptive comment property of each object.
The utility was developed and tested using PB 2017, but it has also been successfully tested in PB versions 2019, 2021, 2022 and 2025. Regardless of which version you use to run and/or build the Code Count utility, it can successfully scan application code in either Workspace or Solution formats from any Appeon-provided version of PowerBuilder. The scanning of libraries from versions of PowerBuilder preceding version 2017 has been tested successfully in a very limited manner, so I am unable to state that it will always work on pre-2017 libraries.
Here's a screen shot of the Code Count window:

You have the ability to select any or all of the ten PowerBuilder object types:
![]()
If you are not concerned about determining line count metrics, you can disable the collection of object size and/or line counts. Scans run markedly faster when line counts are disabled. You can choose from several report views or switch views after a scan has completed. The views by Object Type are useful in determining the total number of each type of object within the selected libraries. For example, if you wish to quickly determine the number of DataWindows in your application, uncheck all object types except for "DataWindow", uncheck the "Lines of Code" checkbox (shown below), and select all libraries.
![]()
Click the "Target..." command button to choose the Workspace Target or Solution Project to be scanned. After the target or project has been selected, a list of all of the libraries in its Library List are shown:

All libraries in the target or project are selected automatically. Extended row selection (example shown above) actions are supported, such as (Ctrl+click) to select/de-select a single row and (Ctrl+Shift+click) to select/de-select a range of rows. When some or all libraries are not selected, the "Select All" button will ensure all libraries are selected. This button changes to "Unselect All" when all libraries are selected.
An example of the "PBL and Object type (without comments)" report view is shown in the full window snapshot.
Below the report are command buttons to (1) save the report data in one of PowerBuilder's supported formats, (2) print the report, and (3) close the application.
The status area to the right of the Print button shows which library and object is being scanned while the scan runs. The status area displays a scan summary when the scan has finished, as shown below:
![]()
I hope you find the Code Count utility useful. Your feedback is welcomed and appreciated!
This message has an attachment file.
Please log in or register to see it.
Last Edit: 1 week 1 day ago by Aubrey Lin @Appeon .
Please Log in or Create an account to join the conversation.
Thank you, David! You're probably right, as the Print command button was a late addition to the window. I'll check and make the fix.
I've also incorporated the use of a blob with the LibraryExport PowerScript function, so as to be able to successfully create exported syntax strings having a length in excess of 32K. I'll get that in a refresh of the app as well.
* Updated 2025-Dec-29 *
The original app has been updated with the minor fixes/improvements listed above.
Last Edit: 1 week 1 day ago by John Fauss .
Please Log in or Create an account to join the conversation.
Nice one! Works really well.
I think you missed this line out of the ue_initresize
This.inv_Resize.of_Register(cb_print,This.inv_Resize.FIXEDBOTTOM)
Please Log in or Create an account to join the conversation.
Great work and congratulations! This tool is very useful for analyzing PowerBuilder code metrics.
Thank you for sharing it.
Please Log in or Create an account to join the conversation.