PyPb in Action: PowerBuilder and Python Building Executive Sales Charts
PyPb in Action: PowerBuilder and Python Building Executive Sales Charts
A technical demo of direct integration between PowerBuilder 2025 R2, PyPb, Python, Plotly, and Excel.
Introduction
This demo shows how a PowerBuilder window can execute Python code directly to build interactive visualizations, analyze sales data, and export reports to Excel without turning the application into a web solution or depending on an external API.
The integration is based on PyPb, the project published by Appeon at github.com/Appeon/PyPb ;. According to the official repository documentation, PyPb is a library that wraps Python.NET so PowerBuilder can interact with Python code: import modules, instantiate classes, invoke methods, read properties, and use popular libraries such as pandas, numpy, OpenCV, and openpyxl. In this demo, that concept is used to consume custom Python modules directly from PowerScript.
The goal of the demo is to keep PowerBuilder as the business interface and use Python as the analytical engine to generate Plotly charts, detect outliers, calculate trends, display volatility bands, and produce formatted Excel files.
How To Extract And Run The Demo
The demo package is delivered as multiple independent ZIP files because the embedded Python runtime and required libraries exceed the upload size limit. Download all ZIP files and place them in the same folder before extracting them.
Required files:
demo_PyPb_parte_01_base.zip
demo_PyPb_parte_02_python_base.zip
demo_PyPb_parte_03_python_aux.zip
demo_PyPb_parte_04_site_packages_plotly.zip
demo_PyPb_parte_05_site_packages_kaleido.zip
demo_PyPb_parte_06_site_packages_excel.zip
demo_PyPb_parte_07_site_packages_rest.zip
To extract the demo, install 7-Zip if it is not already available. Then extract each ZIP file into the same destination folder. For example, create a folder named demo_PyPb and extract every ZIP file into that folder.
When Windows or 7-Zip asks whether you want to merge folders or combine existing directories, choose Yes. All ZIP files are complementary packages and together rebuild the complete demo structure.
After extraction, the demo folder must contain the PowerBuilder application files, the PyPb binaries, the local Python runtime, and the Python scripts used by the window:
bin.pypb.appeon\
pypblib.pbl\
python.runtime\
demo_pbpython.pbl
demo_pbpython.pbt
demo_pbpython.pbw
graficador_ventas_actual.py
pypb_demo.py
The python.runtime folder is included so the demo can run on a computer even if Python is not installed globally. Keep this folder in the same directory as the PowerBuilder files, because the window resolves the local runtime from the demo folder.
To run the demo, open the PowerBuilder workspace or target file and execute the application:
demo_pbpython.pbw
or
demo_pbpython.pbt
Once the window opens, retrieve the sales data, select one or more chart options, and generate the chart. The available options are:
- Trend
- Volatility
- Outliers
You can also export the current chart and the formatted sales table to Excel. The Excel output uses the same analytical options selected in the PowerBuilder window.
For more detailed documentation and a full technical explanation, please refer to the article “PyPb in Action: PowerBuilder and Python Building Executive Sales Charts.”
Luis Avilan
This message has an attachment file.
Please log in or register to see it.
Please Log in or Create an account to join the conversation.