Featured Products
Omegabundle for Xojo 2024 Products

Valentina Reports now can use the power of Python for flexible report generation.

Valentina Release 14 introduced a unified scripting model which included Valentina Reports for Xojo. Here’s how you can use Python in your reports:

  • Source Queries. Create dynamic and complex data sources for your reports using Python. You can write custom queries to retrieve data directly, tailored to your specific needs.
  • Expressions. Enhance your reports with dynamic calculations and data manipulation. Python expressions can be embedded within the report itself, enabling you to perform calculations, format data, or even conditionally display elements based on specific criteria.
  • Scripted Report Generation Stages. Valentina Reports allows you to execute custom Python scripts at different stages of the report generation process. This grants you fine-grained control over the report creation flow. You can use Python scripts to pre-process data, manipulate layout, or even generate dynamic content based on report data.

By incorporating Python into these aspects of Valentina Reports, you can create highly customized and informative reports that cater to your specific data analysis and presentation needs. Standalone scripts stored in a Project can be loaded using project.loadModule method in expressions and scripts executed during report generation (previously, it was possible only in Valentina Forms).

The Reports Toolbox & Expressions

Valentina Reports has a rich toolbox of controls.

All Valentina Reports Controls

Each control has its own unique set of properties accessible through the Valentina Reports Property Inspector, but also includes script slots that can be triggered before or after they are loaded into a report.

Control Script Slots

 

 

 

You can also write your own expressions in Python.

Creating Expressions in Python

 

 Scripted Report Generation Stages

Script Slots are available at the Report level of a Valentina Report.

Report Level Script Slots in Valentina Reports

You can trigger scripts at each step of the process in building and assembling the report.

This capability greatly expands what can be accomplished through improved sub-reports, which now support multiple layers of reports within reports within reports. This also enables Valentina Reports to create tables of contents of a report.

 

Updated Sample Project

Open up Valentina Studio PRO and you will find that the car_catalog example project is now available in two flavors. One of them has all Python scripting.

 

Related