Home » Data Blocks » Sort Detail Data Block Example - Oracle Forms

Sort Detail Data Block Example - Oracle Forms

Example is given below to sort detail data block data (toggle asc or desc) with push buttons used as header of grid, by setting ORDER_BY property of data block using SET_BLOCK_PROPERTY command.
The following is the screen shot of this example and this form can be downloaded from the below link:
Sort Detail data block example Oracle Forms
In this example two data block are being used, one is to contain push buttons to sort data and one is to hold the data in detail block.
On every push button of header the following code is written on When-Button-Pressed trigger:
If Nvl(Get_Block_Property('scott_emp', order_by), 'ENAME ASC') = 'ENAME ASC' then
Set_Block_Property('scott_emp', order_by, 'ename desc');
Set_Block_Property('scott_emp', order_by, 'ename asc');
End if;
You see in above example when I am getting the current setting of order by property of the block, I am reading it in upper case because it returns in upper case even if I am setting the property in lower case.
On every button the code is the same but only the field name difference is there for every column, you can see in the source code fmb, which I am providing with this example.

Subscribe To Get Email Notifications For Latest Updates Like This:
Enter your email address:

Delivered by FeedBurner