PowerBuilder Manual Book Part 2

PowerBuilder Curriculum Part 2

IV. Data window

1. Function

functionparameterdescription
dw_1.insertrow(row)row sets the insertion positioninsert blank line
When successful, return the row number inserted successfully, and return -1 if failed
insertrow(0) means to insert a row in the last row
dw_1.deleterow(row)row the row number to deletedelete row
Returns 1 on success, -1 on failure
deleterow(0) means delete the current row
dw_1.retrieve()dw_1.retrieve(parameter 1, parameter 2, parameter 3…)retrieve data
dw_1.update (accept,resetflag)accept: the default is true, call before executionmodify or update operation
resetflag is true by default, and the data window automatically resets the update flag.
Returns 1 on success, -1 on failure
dw_1.setsort(format)format: A ascending order, D descending orderset sort
Returns 1 on success, -1 on failure
dw_1.sort()Returns 1 on success, -1 on failureAccording to the current data window
sorting rules for sorting
sequence
dw_1.setfilter(format)format: is a string, can be defined using field name or field numberSet filter conditions for the data window
Returns 1 on success, -1 on failure
Example 1: dw_1.setfilter(“age > 25 and age < 45”)
Example 2: dw_1.setfilter(“#3>25”)
Example 3: dw_1.setfilter(“”)
dw_1filter() datawindow
filter
dw_1.reset()Returns 1 on success, -1 on failureClear all data windows
have data
dw_1.scroll(number)number: the number of rows to scrollSet the number of rows to scroll
Scroll down when the parameter is positive and scroll up when it is negative
Successfully returns the data line number displayed in the first line of the control, and returns -1 when it fails
dw_1.scrolltorow(row)row specifies the row numberscroll to the specified line
Returns 1 on success, -1 on failure
dw_1.scrollpriorpage() scroll to previous page
dw_1.ScrollNextPage() scroll to next page
dw_1.scrollpriorrow() scroll to previous line
dw_1.scrollnextrow() scroll to next line
dw_1.getrow()Returns 0 when there is no current line, returns -1 on failure, and returns the current line number on successGet the line number of the current line
dw_1.getcolumn()Returns 0 when there is no current column, returns -1 on failure, and returns the current column if successfulGet the column number of the current column
column number
dw_1.setrow(row)row specifies the row numberset current line
Returns 1 on success, -1 on failure
dw_1.setcolumn (column)coumn column number or column nameset current column
Returns 1 on success, -1 on failure
Example: Set the current column as column 5
dw_1.setcolumn(5)
 
Example: Set the current column as the age column
dw_1.setcolumn(“age”)
functionparameterdescription
dw_1.setrowfocusindicator (f,x,y)f Visual icon to indicate the current lineset to indicate the current row visualization icon
x x coordinates
y y coordinate
Returns 1 on success, -1 on failure
Example: Setting the hand icon
dw_1.setrowfocusindicator(Hand!)
Example 2: Set the picture control p_arrow as the indicator icon
dw_1.setrowfocusindicator(p_arrow)
dw_1.rowcount()Returns 0 when there is no data, returns -1 on failureGet data window head office number
dw_1.modifiedcount()Returns the number of data rows that have been modified but not updated, and returns 0 if there is no data, and fails Return -1 on defeatGet the data window is Modified, but not updated The number of rows of data. (Not included including the newly inserted row)
dw_1.deletedcount()Returns 0 when there is no data, returns -1 on failureTo get the data window do marked for deletion, did not The number of update operations Number of data rows
dw_1.filteredcount()Returns 0 when there is no data, returns -1 on failureGet the filtered number Number of data rows
dw_1.accepttext() Will still be editing the number data, sent to the data window port controls
dw_1.gettext Get the edit control in the text
dw_1.settext(text)Returns 1 on success, -1 on failureSet the edit control’s text
dw_1.getitemdate (row,column, dwbuffer,originalvalue)row specifies the row number of the data rowGet the date of the specified field period variable
column: the specified data column
dwbuffer specifies the buffer for reading data
When originalvalue is true, return the value of the original buffer, which is
Returns the current value when false
Example: Take the date variable of the first_day field in the third row of the data window dw_1
dw_1.getitemdate (3,”first_day”)
dw_1.getitemdatetime()row specifies the row number of the data rowGet the date of the specified field time variable
column: the specified data column
dwbuffer specifies the buffer for reading data
When originalvalue is true, return the value of the original buffer, which is
Returns the current value when false
dw_1.getitemtime()row specifies the row number of the data rowWhen getting the specified field Intervariate
column: the specified data column
dwbuffer specifies the buffer for reading data
When originalvalue is true, return the value of the original buffer, which is
Returns the current value when false
dw_1.getitemstring()row specifies the row number of the data rowGet the word of the specified field
column: the specified data column
dwbuffer specifies the buffer for reading data
When originalvalue is true, return the value of the original buffer, which is
Returns the current value when false
functionparameterDescription
dw_1.getitemnumber()row specifies the row number of the data rowGet the number of the specified field value variable
column: the specified data column
dwbuffer specifies the buffer for reading data
When originalvalue is true, return the value of the original buffer, which is
Returns the current value when false
dw_1.getitemdecimal()row specifies the row number of the data rowGet the small of the specified field numeric variable
column: the specified data column
dwbuffer specifies the buffer for reading data
When originalvalue is true, return the value of the original buffer, which is
Returns the current value when false
dw_1.sharedata (dwsecondary)Returns 1 on success, -1 on failuredata window control data share, keep in sync new
dw_1.sharedataoff()Returns 1 on success, -1 on failureClose between data windows shared relationship
dw_1.print()canceldialog: The default is true to display a non-modal cancel print dialog frameprint data window
Returns 1 on success, -1 on failure
dw_1.printcancel()Returns 1 on success, -1 on failureCancel the opening of the data window print
dw_1.getitemstatus (row,colum,dwbuffer)row specifies the row number of the dataGet the status of the specified field state
The data column specified by column
dwbuffer specifies the buffer for reading data, the default is the main buffer,
Returns a dwitemstatus enumeration variable
Example: Take the work field in the fifth line of the data window dw_1 in the filter buffer state
l_status
l_status = dw_1.getitemstatus (5,’work’,filter!)
dw_1.setitemstatus (row,colum, dwbuffer,status)row specifies the row number of the dataSet the status of the specified field state
The data column specified by column
dwbuffer specifies the buffer for reading data, the default is the main buffer,
Returns a dwitemstatus enumeration variable
status enumeration variable
Example: Set the party field in line 5 of the data window dw_1 in the main buffer Status is notmodified
l_status
l_status=
dw_1.setitemstatus (5,’salary’,primary!,notmodified!)
dw_1.setitem (row,column,value)the row specified by rowAssign a value to the specified field
column specified column
the content of the value assignment
dw_1.getvalidate (column)column defines the field (serial number or field name) of the inspection rule. Return Validity check rules for specified fieldsGet some current fields Validity testing rules for
dw_1.setvalidate (column,rule)column defines the field of the inspection rule (serial number or field name) rule new validity check ruleSet current some fields  Validity testing rules for
Returns 1 on success, -1 on failure

2. crud

(1), put the edited data into the main buffer

(2) Add data

(3), delete data

(4), update data

(5), retrieve data

1. To set the external transaction object of the data window control, connect, commit, disconnect must be specified

2. It is used to set the value of the internal affairs of the data window control. Automatically connect, commit, disconnect

3. Set the field to read-only

Method 1. Set tab order to 0
Method 2, dw_1.modify(“cname.tabsequence = 0”)
Method 3, dw_1.modify( “meno.edit.displayonly=yes”)
Method 4, dw_1.modify(“code_course.protect= 1”)

4. Switch data window

5. Hide the data window refresh process

6. Data window sharing

7. Pass the in parameter in the data window SQL

8. Get the sql of the current data window

9. Set the sql of the current data window

10. Call the sub data window

11. Determine whether the data window has been modified

12. Reset the data window

13. Data window regrouping

14. Get the state of the data window

15. Set the status of the data window

16. Find the first selected row in the data window

17. Data window search (find)

18. Data window filter

(1), column name filter

(2), conditional filter

(3), clear filter

(4), sql statement filtering

19. Data window pagination

  1. Add a calculated column
    This calculated column must be placed in the detail segment
    Input in expression: ceiling(getrow()/500) <–500 here can also be replaced by a global function
    This allows the user to arbitrarily set how many rows per page.
  2. To define a group, select the menu rows->create group…
    Group by calculated column field, and check box–>new page on group break must be selected.
  3. Make this calculated column invisible.
    Then add the following buttons to complete the pagination function

(1), home page

(2), previous page

(3), next page

(4), last page

20. Data window sorting

(1), positive sequence

(2) Arrange in reverse order

(3), Double click to sort

21. Data window focus

22. line

(1), row processing

(2), highlighting

1. In the click event of the data window, write the following code

2. In the rowfocuschanged event of the data window, write the following code

(3), interlaced color change

  1. Open the data window
  2. Right click detail
  3. Find the small icon on the right side of the color property on the right
  4. Enter the following code in the expression

(4), self-increasing row

  1. Add a calculated column, page n of n
  2. select getrow()

(5), set the number of print lines per page

  1. Add a calculated column page n of n and enter the formula: ceiling(getrow()/20)
  2. Select the menu rows->create group to create a group, and select the formula column page_1 just created
  3. After creating the group, select the attribute on the right, and tick the new page on group break
  4. If the last page needs to be filled with blank lines

(6), mobile line

(7), copy row

23. Columns

(1), get the column name of the data window

(2), get the dbname corresponding to the field

(3), copy column

(4), get display column

24. Data window multi-selection box

(1), in the sql of the data window, add a multi-select box field

(2) Set the edit property of the field to checkbox and check 3d look
(3), set (data value for on = 1), set (data value for off = 0)
(4) Write in the click event of the dw_1 data window

(5) How to get the value?

25. datastore

26. Dynamic data window

(1), parameter transmission and reception

(2), describe (get various attributes in the data window)

(3), modify (modify various attributes in the data window)

(4), use syntaxfromsql to dynamically create data windows

27. Import and export

(1), data window import

(2), data window export

28. Data window shortcut keys

29. How to set the current row indicator icon of datawindow?

30. How to change the Grid style to free format?

Change the 1 of processing=1 to 0 in the editsource of DW

31. How to automatically wrap the data beyond the content of the column?

  1. Find the column you want to set
  2. Select the Position tab, and select the Autosize Height checkbox.
  3. Click on the Detail Band (that is, the long gray band with Detail), and select the Autosize Height multi-selection box on the right

PowerBuilder Manual Book Part 3 ClickHere

Good Luck!

PassWords

About The Author

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments