Realization of free definition of PB dynamic report format

Source: Internet
Author: User
Tags table name

In the usual server/client mode mis development, there are always endless reports need to be made, the time to debug the report is also the most tedious, and often can not meet customer requirements. If you can let the user adjust the format and content of the report, and then save it, the next time the program starts, it automatically calls the saved report format that's how good. I finally realized the requirements through the following methods.

PB (PowerBuilder) has a special file format to save the report at the end of PSR (this is referred to as the PSR file). According to the principle that the data window can directly read the PSR file to generate the report, the program will save the dynamic report format by generating the PSR file.

First, the realization principle:

The report in PB is actually the equivalent of a data window.

The first step is to implement the dynamic report. By setting the resizeable and moveable properties of the Data Window objects (DataObject), such as the Chinese text, columns, and so on, to achieve the drag control of the object position, the Modify function of the data window is used to change the object value (including adding and deleting).

The second step is to save the report format. In an application, the name of the data window object is always unique, transforming each data window object into a PSR file in a database table. When the window is open, the program first verifies that the report format exists. If present, read the report format in a temporary file, then set the Data window (DataWindow) data Object (DataObject) as the report file, then extract the data, and if not, extract the data directly.

Second, the realization process:

1, set up a database table to save the report format file.

Table Name: Dyn_report
Dwobject VARCHAR2 (20) Data Window object Name Primary Key
Rptitle VARCHAR2 (80) Title Name of the report
Memo Long Raw Report Format

2, establish a window w_temp. Define instance variables as follows:

String Is_dwtype,is_dwobject//Save the type and name of the object in the report

Control Name Control meaning
Dw_print Data Window objects
Cb_exit Exit button
Cb_savereport Report Format Save button

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.