This buffer holds the original data. It is read only and invisible to user. You can use it to restore data back to its original values, or you can even use it to do some validation of your own. Strictly speaking, this is not a buffer. Sybase does not call it one
How do I access values in the original buffer?
The GetItem() function has optional arguments to specify buffer and original value. Note, there is no “original!” buffer to enter, instead you just set the original key word
LName = dw_employee.GetItemString(3, “emp_name”, Primary!, TRUE)
I don’t know if “Primary!” is required, it is probably the default. TRUE refers to the original value.
This buffer is what is viewable. It is the default buffer for Retrieve(), ImportFile() and InsertRow(). It is a Potential source of SQL Insert and Update statements
How do I know how many rows exist in the Primary buffer?
Li_cnt = dw_1.RowCount()
This buffer is for rows “filtered out” of Primary buffer by Filter(). The Datawindow painter can also have a filter designated. It is Invisible to user. This is a potential source of SQL Insert and Update statements. Use the GetItemX or dot notation to get the values from this buffer.
How do I know the number of rows in the Filter Buffer?
Li_count = dw_1.FilteredCount()Filter( )
You can filter on the server side with the WHERE clause. Use this dialog to verify the syntax of a filter string you wish to build in script. This can be a big time saver.
String ls_filter Ls_filter = “State=’CA’ AND Status = ‘A’ AND Salary > 25000” Dw_1.SetFilter(ls_filter) Dw_1.Filter( )
To filter a DataWindow object with groups, call GroupCalc( ) after you call Filter( ). GroupCalc forces the DataWindow engine to recalculate the breaks in the grouping levels after you have added or modified rows in a DataWindow.
To have a “Specify Filter” dialog box appear, set a string variable to NULL, and pass it as the argument to SetFilter( ). A subsequent Filter( ) will open the dialog box.
To find the current filter:
Or if you are using the PFC
dwcontrol.inv_filter.of_GetFilter ( )
By the way you can use this in a datawindow computed column as well – like Describe(“datawindow.table.filter”). This is a great footer to put at the end of all your reports.
If you dw_1.SetFilter(ls_filter) and then dw_1.Filter(), any rows in the filter buffer are first moved back to the primary buffer before the new filter is applied
The filter buffer is included in the update.
Verifying that a filter expression is okay
To simulate the Verify function in the datawindow’s Verify button, use evaluate:
<string variable> = <datawindow>.describe(“Evaluate(<expression>, <rownum>)”)
Describe will return an “!” if any part of the expression is invalid. Here is the code to Verify a filter string:
String ls_ret, ls_filter, ls_eval ls_filter = mle_filter.text Ls_eval = “Evaluate(‘” + ls_filter + “’,0)” Ls_ret = dw_1.Describe(ls_eval) If trim(ls_ret) = “false” then MessageBox(“Datawindow”, “Filter expression is OK”) Else If trim(ls_ret) <> “!” then MessaeBox(“DataWiindow”, “Expression is not Valid”) End if End if
Note: no messagebox is needed for ls_ret equaling “!” because the datawindow automatically displays this. Because the row specified is 0, a valid filter expression is always going to return “false.” Any ls_ret which is not false or “!” is a valid expression but not a valid filter expression.
Holds rows deleted using DeleteRow(). It is Invisible to the user. Source of SQL Delete statements
Use GetItemX functions or dot notation to get the value
integer li_delete_cnt, li_row, li_del_row, ll_emp_id
li_delete_cnt = idw_prov_selected.DeletedCount()
li_row = 0
li_del_row = 0
do while li_row < li_delete_cnt and li_del_row = 0 li_row ++ ll_emp_id = idw_prov_selected.GetItemNumber(li_row, "emp_id", Delete!, FALSE) ls_prov_cd = idw_prov_selected.GetItemString(li_row, "prov_code", Delete!, FALSE) if as_prov_cd = ls_prov_cd and al_emp_id = ll_emp_id then li_del_row = li_row end if loop Return li_del_row[/sourcecode] How do I know the number of rows in the Delete Filter Buffer?
Li_cnt = dw_1.DeletedCount()
9 Comments »
- 1. PowerBuilder General
- 2. Datawindows
- 3. PFC