Click Column Titles in OracleEBSForm for sorting

Source: Internet
Author: User
During EBS form development, although the folder function provides the sorting function, you can specify the sorting of the first three columns for data blocks in multiple rows, you can also click the title of the first three columns to sort

During EBS form development, although the folder function provides the sorting function, you can specify the sorting of the first three columns for data blocks in multiple rows, you can also click the title of the first three columns to sort

27.1 Problem Description

During EBS form development, although the folder function provides the sorting function, you can specify the sorting of the first three columns for data blocks in multiple rows, you can also click the titles of the first three columns to sort, but you cannot sort more columns. If you want to sort more columns, you must drag the columns to be sorted to the first three columns, which is highly restrictive. In the MRPII system, we can sort the names of click columns for any column. How can we achieve automatic sorting of click Column Titles while ensuring the folder function?

27.2 Solutions

After testing, I think the folder function is sorted BY changing the ORDER BY attribute of the corresponding data block and then executing the query, not on the client, the database server is used for sorting. After understanding this principle, you can proceed. You need to use the folder function to click the column title for sorting. Specifically, the corresponding data block must have a data block name and a _ PROMPT data block, the project Name attribute of this block must be the data source field Name of the corresponding column. If you use the folder function according to the specifications, this premise has been met. Scenario: a multiline data block named BILL_LINES implements the folder function. The corresponding column title data block is BILL_LINES_PROMPT, and the following is the implementation part:

Step 1: Create a new Parameter, set the Name attribute to SORT_RULE, set the Parameter Data Type attribute to Char, set the Maximum Length attribute to 150, and set the Parameter Initial Value to NO_RULE, as shown in:

Step 2: Create the BLOCK_SORT package. The code used in the package description is as follows:

PACKAGE BLOCK_SORT IS

PROCEDURE GET_SORT (block_item IN VARCHAR2 );

PROCEDURE CALL_SORT (sort_rule IN VARCHAR2 );

END;

The code used by the package body is as follows:

Package body BLOCK_SORT IS

Procedure GET_SORT (block_item IN VARCHAR2) IS

Block_name varchar2 (80 );

Item_name varchar2 (80 );

Order_by1 varchar2 (80 );

I number;

BEGIN

I: = INSTR (block_item, '_ prompt ');

IF I> 1 THEN

Item_name: = SUBSTR (block_item, I + 8 );

Block_name: = SUBSTR (block_item, 1, I-1 );

Order_by1: = GET_BLOCK_PROPERTY (block_name, ORDER_BY );

If instr (order_by1, item_name)> = 1 THEN

If instr (UPPER (order_by1), 'desc')> = 1 then

: PARAMETER. SORT_RULE: = 'y' | block_name | '| item_name;

ELSE

: PARAMETER. SORT_RULE: = 'y' | block_name | '| item_name | 'desc ';

End if;

ELSE

: PARAMETER. SORT_RULE: = 'y' | block_name | '| item_name;

End if;

Do_Key ('execute _ query ');

: PARAMETER. SORT_RULE: = 'n' | SUBSTR (: PARAMETER. SORT_RULE, 2 );

End if;

END GET_SORT;

PROCEDURE CALL_SORT (sort_rule IN VARCHAR2) IS

Block_name varchar2 (80 );

Sort_rule_new varchar2 (80 );

I number;

BEGIN

I: = INSTR (sort_rule, '| ');

IF I> 1 THEN

Block_name: = SUBSTR (sort_rule, 2, I-2 );

Sort_rule_new: = SUBSTR (sort_rule, I + 1 );

SET_BLOCK_PROPERTY (block_name, ORDER_BY, sort_rule_new );

End if;

END CALL_SORT;

END;

Step 3: Click the column title to sort the column title, for example, in the Code app_folder.event ('when-MOUSE-up') in the when-UP trigger of the OSALE_PRICE project of the BILL_LINES_PROMPT data block, add the following code.

BLOCK_SORT.GET_SORT (: SYSTEM. TRIGGER_ITEM );

If you want to sort multiple columns by clicking Column Titles, repeat this step multiple times to add a line of code.

Step 4: In the data block to be queried, here is the app_folder.event ('pre-query') of the BILL_LINES PRE-QUERY event; Add the following code after the code. :

If substr (: PARAMETER. SORT_RULE, 1,1) = 'y' THEN

BLOCK_SORT.CALL_SORT (: PARAMETER. SORT_RULE );

End if;

The functions mentioned in this example have been implemented after completing the above steps. Of course, they can be expanded to make it easier to use.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.