PB 7.0 enables continuous printing of multiple data windows

Source: Internet
Author: User

PowerBuilder 's most fascinating place is her powerful data window technology, which provides a wealth of tools to show the nature of data, data windows can extract data from a variety of data sources, and then display in a variety of styles in front of users, For a PB programmer can use a live data window is so important, but also reflects the programmer a certain level of technology. I believe that after reading this article will be helpful to you to write a program, the text if there are any irregularities are also invited colleagues to advise.

In the actual application we may encounter the user has such a request, in the first report to print a customer's purchase of merchandise statistics, the future of each page shows that he purchased a clear list of goods. That is, the equivalent of printing two reports, one is the statistical report, the other is the schedule. This is not a difficult task for any PB programmer in terms of just these two reports, it can be easily done, we can print the two reports to the user, but it always makes us feel that there is something missing, after all, users want to let these two reports as a whole appear, The minimum requirement is that their page numbers should be sequential and also tell the total number of pages the user has. This involves the issue of continuous printing of multiple data windows.

First, the statistics and details of the results are based on user input conditions to get, this is a variable result, we can not know in advance how many data, let alone how many pages need. Even we can determine how many of the data will appear differently because of the different paper settings of the user's printer. Second, to show in the tables and the list of the total number of reports, this is a bit difficult, after all, for both reports is an unknown, that is, for statistics, it can know their total number of pages, but do not know the total number of pages of the list. The same is true for schedules, which only know their total number of pages, and do not know the total number of pages of the tables. This makes it difficult to show the sum of their pages in two reports separately. While this can be determined for their own purposes, this can be easily achieved by simply invoking the inline function page () of the Data window.

Below we have a simple example to explore how to implement multiple data window continuous printing technology. The program first allows the user to enter the customer number, and then the system according to the user entered the customer number of the customer to count the total number of purchases of all types of goods and order the details of each item. The execution of the entire program is shown in the following three figure:

Before we start, let's look at the structure of the three tables used in the example and how they relate to each other, as shown in the following figure:

where table customer and table Sales_order are associated by cust_id (customer number), table sales_order and table Sales_order_items are associated by ID (sales order number). These three tables are taken from the demo database with PB.

The first thing we have to do is make two data windows with retrieve parameters, which is very simple and I will not elaborate. Among them, the statistics table is named Dw_1, the schedule is named Dw_2. At the same time, in order to display the user "how many pages in a page" at the time of printing, a computed field is added to the bottom of each page of the two reports to display the current page and total page information. Taking statistics Dw_1 as an example, add two fields in Dw_1, named Page_1 and computer_2. See figure below:

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.