The report is a very important status in daily management, and users often need to output content in the database in different formats. PowerBuilder provides a DataWindow control with a variety of display style, as long as you use flexible use, you can make a variety of reports. This paper combines the actual development experience of the author, taking a statement of the report output as an example, talking about the report output.
1. Two Table: Projects in the database, Manufacture (Inquiry vendor). The structure is as follows:
Project (XMBH, GG, XH, Psyj ...)
Manufacture (XMBH, CSMC, XJCX, GG, XH, BJ ...)
The contents of the Project table:
XMBH GG XH Psyjj
001 GG001 XH001 AAA
The contents of the Manufacture table:
XMBH CSMC XJCX GG XH BJ
001 Manufacturer 1 1 GG1 XH1 100.00
001 Manufacturer 2 2 GG2 XH2 101.00
001 Manufacturer 3 3 GG3 XH3 102.00
Second, the output report format: (the color of the words in the actual report is black, the bottom color is white)
Project number 001
We request manufacturers 1 manufacturer 2 manufacturers 3
Specification GG001 GG1 GG2 GG3
Model XH001 XH1 XH2 XH3
Quote 100.00 101.00 102.00
Review view AAA
Third, implementation method
As can be seen from the figure, the report contains two records of the Project and Manufacture, and requires the records in the Manufacture to be output in the form of columns. The specific implementation method is as follows:
method 1:
According to Figure 1. Create a DataWindow (DW_1) in a FreeForm format, select the content you need in the Project, set its argument to XMBH. The format is not shown in the gray bottom.
Create DataWindow (DW_2) in a Label format, select the content you need in Manufacture, and set its argument to XMBH; double-click the DataWindow's blank area, open the property dialog, mainly set the definition property page:
(1) Label Item: Set the number of Label's width, height, and the number of Label per page;
(2) Margins item: Specify the spacing between the upper, lower, left, right and label between Label;
(3) Arrange item: Label scheme: from left to right or from above
Open DW_1, insert a nested
Report control, select Report to DW_2. According to the position of the gray bottom area, adjust the REPORT, and set the refiner, the arguments property page, set the Border of the General property page for none, specifying the expression in the arguments page for the XMBH column (this is to avoid preview or print "Special"
Retrieval dialog box).
Adjust the height, width, size, and the spacing of Column and Column in DW_2 until satisfaction. (For the convenience of debugging, it is best to set the Border Border of Column in DW_2 to NONE)
Finally, preview or print DW_1 directly!
Note: The border of the Label format DataWindow cannot be modified, so that the top of DW_2 and the bottom irregular border can still be seen when the DW_1 preview is previewed, but does not affect the printing effect. It is not difficult to solve this problem, just insert two of the two color-colored rectangles in DW_1, place them on the top of the gray area and bottom, and put them above DW_2, then the table in DW_1 Line "Bring"
TO Front.
Method 2:
According to Figure 1. Create a DataWindow (DW_1) in a FreeForm format, select the content you need in the Project, set its argument to XMBH. The format is not shown in the gray bottom.
Create a DataWindow (DW_2) in a FreeForm format, select the content you need in Manufacture, and set its argument to XMBH. Note: To select the XJCX column, in order not to display and print this column, you can use it for Foreground.
The Color is set to color colors with background (not deleted in DataWindow).
Open dw_1, insert three Nested Report controls, Report
All choose DW_2. Press the position of the gray bottom area to adjust the three Reports, and set the General, Arguments property page, set the Border of the General property page for None, specifying the Expression in the arguments page for the XMBH column. In addition, the criteria property page is set separately for each Report, specifying the criteria value of the XJCX column to 1, 2, 3.
Adjust the height, width, size, and the spacing of Column and Column in DW_2 until satisfaction.
Finally, preview or print DW_1 directly!
The above two methods are the summary and summary of the report output of this type (Figure 1), and it is also a skill, I hope to help everyone.