cancel
Showing results for 
Search instead for 
Did you mean: 

how to find out row in delete buffer for dw?

Former Member
0 Kudos

I have a datawindow dw_1.  I use following script to move all data from Primary buffer to Delete buffer.

dw_1.RowsMove(1, dw_1.RowCount(), Primary!, dw_1,1, Delete!)

Then I want to find out a row in Delete buffer like dw_1.Find(...).

How can I do it? If all datawindow functions can be applied for Delete buffer?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Kent;

  Unfortunately, the DW does not support a buffer option on the Find ( ) method and is thus limited to the Primary buffer.

  As an alternative, you can use the DOT notation or the RowsMove ( ) method to access the Delete buffer and copy those to a DataStore's primary buffer. Now you could use the Find ( ) method on the DS to locate your information. The row number in the DS should be the same as the row number in the DW control (unless you have sorting or filtering active). Thus, the DS becomes your index into the DC's Delete buffer.

HTH

Regards ... Chris

PS: What you are looking for would be a great feature enhancement - not only for the Find ( ) - but for all DC/DS methods that do not have the buffer option.

Former Member
0 Kudos

Hi Chris, hi Kent,

there is a buffer option on the find () method since PB 12.1.

But it is only documented as new feature. The documentation of the find() function was not updated.

see SyBooks Online (Archive)

Former Member
0 Kudos

Hi René ;

OMG .. you are 100% correct and I seem to remember reading about that enhancement a few years ago now that you mention it.

   Looking in the 12.1 & 12.5.1 HELP for the Find method does not show a buffer option in the syntax. So it looks like SAP needs to open a documentation ticket on this!

-----------------------------  HELP -----------------------------------------

Syntax

[PowerBuilder and Web DataWindow server component]

long dwcontrol.Find ( string expression, long start, long end ) 

----------------------------------------------------------------------------------

However, using AutoScript ....

THIS.Find( /*readonly string s*/, /*long b*/, /*long e*/, /*dwbuffer d */)

Regards ... Chris

former_member203861
Participant
0 Kudos

Hi Chris ,

There is an AutoScript option in Pb 12.5 classic ?

Moshe


Former Member
0 Kudos

Hi Moshe;

   Yes, this feature has been there in PB Classic for over a Decade. Originally written by Reed Shilts of Sybase many moons ago. You can activate the AutoScript feature in any script-able painter from the top IDE menu DESIGN => OPTIONS => AUTOSCRIPT

I would recommend checking all the boxes EXCEPT the "Activate Only After Dot". Plus, I personally like the delay time at 700 milliseconds.

HTH

Regards ... Chris

Answers (3)

Answers (3)

Former Member
0 Kudos

Two options:

1. As suggested by Ludwin - create a DS and copy the rows from the delete buffer to the DS and Find() from there.

2. Loop through the deleted rows and find what you're looking for, one row at a time.

Personally, I prefer number 1.

Former Member
0 Kudos

BTW. Wouldn't it be better to find the row before you move it into the deleted buffer?

Former Member
0 Kudos

  That is a great suggestion Ludwin! 

Kent: Use a DW expression on the "Visible" property to control "logical deletes". This would make them still in the primary buffer and searchable via the FIND. On the deletion process, now you can copy these logical deletes to the actual Delete buffer and process from there.

Former Member
0 Kudos

yes, that is what I am trying. thx

Former Member
0 Kudos

Though find() does not work in the deteted buffer you could

- create a datastore,

- assign the dataobject

- sharedata

and then use find() on this datastore.

HTH

Former Member
0 Kudos

Hi Ludwin;

  IMHO - the SHAREDATA will not work as the Find ( ) will still be looking only at the primary buffer. Kent needs to search the Delete buffer.

Regards ... Chris

Former Member
0 Kudos

Hi Chris,

I think you are write!

So he has to rowscopy it back to the DataStore and not ShareData.