GO_RECORD ? [message #247430] |
Mon, 25 June 2007 21:07  |
Felc
Messages: 1 Registered: June 2007
|
Junior Member |
|
|
Hi all experts,
I am trying to bring the record to the first row of the form.
For example I have a form with display from A to Z.
Say if "E" is the one I am interested with, what sort of command should i be using to bring "E" to the first row?
I was using GO_RECORD(1) and it didn't work for me as the form kept on showing "A" as the first row.
Can somebody please help ?
Many thanks
|
|
|
Re: GO_RECORD ? [message #247503 is a reply to message #247430] |
Tue, 26 June 2007 02:50   |
hemavb
Messages: 103 Registered: May 2007 Location: Dubai , UAE
|
Senior Member |
|
|
GO_RECORD(n) will NOT MOVE the record, it will just move the Cursor to the record number provided to it.
You cannot move a record. There is a work around way but will take some programming to do.
Here is what is possible.
Assumed Block Name: DATA
1) Keep one more column in your table name it SORT_ORDER. Now in this column you will store the preference ranking. The once which you want on the top will be 1, then 2 then 3 and so on.
Add this column/field to your DATA block in the form. Keep it a hidden column, i.e., physical property > visible > no.
2) In the Block put SORT_ORDER in the order clause of the Block.
3) Add a POST-QUERY trigger to the block level. Use the following code in this trigger.
:SORT_ORDER := NVL(:SORT_ORDER, (:SYSTEM.TRIGGER_RECORD - 1)) + 1;
4) Use a push button to set preference to a record. In that push button's WHEN-BUTTON-PRESSED trigger write the following code:
:SORT_ORDER := 0;
POST;
GO_BLOCK('DATA')
CLEAR_BLOCK(no_validate);
EXECUTE_QUERY(no_Validate);
FIRST_RECORD;
This should give you your desired result.
Restrictions:
a) It will work only with a block which has a source. It you are using a cursor to populate it will not work. or you may have to modify it a little to work.
b) If there is lot of data/no indexing on your base table, it will be a lil slow.
Its a long shot but gets the work done. Till no other fix is given by one of the geniuses on this forum, use this.
Hemavb
|
|
|
|
Re: GO_RECORD ? [message #252568 is a reply to message #247430] |
Thu, 19 July 2007 03:23  |
zameersait
Messages: 16 Registered: July 2007
|
Junior Member |
|
|
If u want to order the block by any column then use the Order By property of the block. If you are not able to sort the records as you wanted, then add a column in the table to input the soring order and use this column in 'Order By' property of the block.
|
|
|