Powerbuilder Data Window Programming Tips

xiaoxiao2021-03-06  38

PowerBuilder Data Window Programming Tips Selection

Chesheng913's Blog

The reason why PowerBuilder has achieved great achievements, DataWindow is a feature of powerful and flexible, and I have developed some techniques after I have developed with PowerBuilder, and summarize some techniques for use. One. How to create a report, requiring the following form Quantity Running Total 5,000 3,50,500 7,500 3,000 10,500 12,000 22,500 For Running Total columns, we can use computing columns: cumulativesum (Quantity for ALL) to achieve gradually increment and functionality. Two. The four steps confirmed by the data window data to the buffer are determined whether the data type is correct. Trigger the ITEMEMERROR event if it is incorrect. Determine whether the data is in line with the effectiveness rules. If the effectiveness rules are not met, the ITEMEMERROR event is also triggered. It is determined whether there is data being changed. Decision data will trigger the ITEMERROR event if the data and itemchange are repelled by ItemChanged events. three. How to find 1 as a list of data types for DateTime in DataWindow. The following expression is used when the date condition to be found is a constant: ls_find = "DATETIME_COL = DateTime ('1/1/1999')" 2. When the date condition to be found is a variable, use the following expression: ls_find = "DATETIME_COL = DateTime ('" ls_date ")" 3. When the date condition to be found is a DateTime data type, use the following expression: ls_find = "DATETIME_COL = DATETIME ('" string (ldt_datetime) "4. The three ways of setting the data window Boolean properties PowerBuilder provides three ways to set the Boolean properties of the data window, named, DALSE, 1/0, 'Yes' / 'NO'. For example: dw_1.object.address.visible = 0 dw_1.object.address.visible = false dw_1.object.address.visible = 'no' PowerBuilder saves attributes in the form of strings, regardless of the property value is Boole Type, long integer or characters. To further understand, you can export a data window and view its original code, you can find that even the color attribute of the column is also expressed using a number with double quotes. Fives. How to quickly remove multi-line in DataWindow Multi-line operations may often have multi-line deletions, generally use cyclic statements: for ll_rowon = 1 to dw_1.rowcount () dw_1.deleterow (ll_rowon) Next A fast The deletion method is to move the row to be deleted from the main buffer to the delete buffer. For example, delete all rows in the buffer: dw_1.rowsmove (dw_1, 1, dw_1.rowcount, primary!, Dw_1, 1, delete!) But don't forget the filtering rows in different buffers.

six. How to use the Select DistINCT implementation to delete the repeated row in the DataWindow's SQL syntax first to sort the columns you want to display: "City A", then add the following filter strings: "City <> city [-1] or GetRow () = 1 "seven. How to display the line number of each group in the group-in-form of DataWindow, when we display the line number for each line of DataWindow, you can make a simple representation of the getRow (). But for grouping DataWindow, the line number of each group is displayed separately, and the expression should be used as getRow () -first (GETROW () for group 1) 1. Eight. How to change the font color of the column, remind the user that this column has been modified in the colored Color property, enter the following expression IF (Column_name <> column_name.original, RGB (25, 0), RGB (0, 0, 0) ))). In this condition, if this column has changed, the red font is displayed, otherwise the black font is displayed. This expression is mainly used to compare the value of the current column and the value of the value of the original column in the same value to the original column. Nine. Move rows in the data window, but not to do filter or delete the RowsDiscard () function can do this, it performs removal work in the data window, but it is removed. It cannot be deleted or do any modifications. Save. Ten. How to display the current data in the FOOTER BAND in multi-line display, and the last line number we first look at the expressions of the two compute columns: if (GetRow () = first (GetRow () for page), 1, 0) // 1 for the first line of IF for the current page (GetRow () <> 1 and getRow () = last (getRow () for page), 1, 0) // 1 for the last line of the current page As can be known, set the following calculation column expression in the Footer Band: 'Rows' string (get' string) 'to' string (last (get () for page) 'Are Displayed' . This function can be reached. Author Blog:

http://blog.9cbs.net/chensheng913/

转载请注明原文地址:https://www.9cbs.com/read-63412.html

New Post(0)