ISSUE#
On the form I have a scroll bar and a 'delete' button. When an item in the data block is selected, and the 'delete' button is pressed, it deletes the selected item from the database and then executes the data_block query.
By default, this returns the user to the top of the list.
I am trying to navigate to the record just before the one that is deleted from the list.
This can be done using the GO_RECORD(number) Built in Function(BIF) (assuming number is the saved value of :System.cursor_record).
And this is where I run into a problem. The GO_RECORD BIF will bring the record to the top or bottom of the displayed list of items. This can cause the list to shift up 20 items without warning.
i.e. For example Records 23 - 47 from the data_block are being displayed, and record 33 is selected. If record 33 is deleted and we use the function GO_RECORD(32), then the records diplayed will be 32-56 (effectively shifting the list down 9 records).
Solution #
Add this piece of code
l_top_rec:= GET_BLOCK_PROPERTY('EXP_DETAIL_BLK', TOP_RECORD);
l_cur_rec:= :SYSTEM.CURSOR_RECORD;
Your code--------------------------
go_block(block_name);
--
first_record;
loop
exit when GET_BLOCK_PROPERTY(block_name, TOP_RECORD) = l_top_rec;
next_record;
end loop;
go_record(l_top_rec);
--
loop
exit when :SYSTEM.CURSOR_RECORD = l_cur_rec or :SYSTEM.LAST_RECORD = 'TRUE';
next_record;
end loop;
No comments:
Post a Comment