Home » Developer & Programmer » Forms » Custom ORDER BY in a multi record data block (Oracle Forms 6i)
Custom ORDER BY in a multi record data block [message #511885] Wed, 15 June 2011 14:21 Go to next message
AramDerian
Messages: 6
Registered: June 2011
Location: LACMTA
Junior Member
I have data block that has hundreds of records. On a screen I display 20 records at a time. On that same screen I have "find badge" function where user types badge/employee id and presses a button to find the record in a data block. I have no problem finding the records in a list and pointing the curser to appropriate record. My question is (which is a user request) if the badge/employee id is found to make that record to be the first record in a list. Is it possible?


[MERGED and RENAMED by LF]

[Updated on: Thu, 16 June 2011 00:11] by Moderator

Report message to a moderator

Re: multe record data block [merged 2] [message #511911 is a reply to message #511885] Thu, 16 June 2011 00:09 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Yes; you should modify block's ORDER BY property. In order to do that, you'd use SET_BLOCK_PROPERTY built-in. Here's an example of how to do it:
SQL> select empno, ename, job, sal
  2  from emp
  3  order by case when ename = 'SCOTT' then 1
  4                else empno
  5           end;

     EMPNO ENAME      JOB              SAL
---------- ---------- --------- ----------
      7788 SCOTT      ANALYST         3800
      7369 SMITH      CLERK           1600
      7499 ALLEN      SALESMAN        2400
      7521 WARD       SALESMAN        2050
      7566 JONES      MANAGER         3775
      7654 MARTIN     SALESMAN        2050
      7698 BLAKE      MANAGER         3650
      7782 CLARK      MANAGER         3250
      7839 KING       PRESIDENT       5800
      7844 TURNER     SALESMAN        2300
      7876 ADAMS      CLERK           1900
      7900 JAMES      CLERK           1750
      7902 FORD       ANALYST         3800
      7934 MILLER     CLERK           2100

'SCOTT' in my example would be your "badge / employee id".
Re: multe record data block [merged 2] [message #511918 is a reply to message #511911] Thu, 16 June 2011 01:43 Go to previous message
cookiemonster
Messages: 13937
Registered: September 2008
Location: Rainy Manchester
Senior Member
Of course that means re-querying the data every time they do this (with execute_query) and if the users entered search criteria in enter-query mode you would have to account for that.
Previous Topic: Add checkbox with hierarchical tree node in oracle forms
Next Topic: Repeat same record
Goto Forum:
  


Current Time: Sat Sep 07 16:04:49 CDT 2024