Solved

Record count on Database Block

Posted on 2013-12-21
10
619 Views
Last Modified: 2013-12-29
Record count on Database Block

Hi all,

I have 2 canvas (1 canvas having database block items ,2nd having control block items & FIND button also in Control block), My requirement is when i select any one of the lov and click on the find button(in 2nd canvas , control block canvas)
then it navigates to the database block canvas and displays records, at that time i want to display record count message. for this i add on-count trigger on form level, but not working, Could any one suggest me please.

And also i have written Get_block_property on function also


declare
  cnt number := 1;
begin
  go_block('HOPE_FORECAST_DATA');
  first_record;

  while :system.last_record = 'FALSE'
  loop
     cnt := cnt + 1;
     next_record;
  end loop;
 
  message('There are ' || cnt || ' records in this block');
end;
0
Comment
Question by:hinamansoor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
10 Comments
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 39734693
Hi, in what application are you developing?
0
 
LVL 20

Expert Comment

by:flow01
ID: 39735010
"then it navigates to the database block canvas and displays records,"
Do you have that part working ?
Can you show that part of the code ?

I would expect an execute_query in it .
After that statement add
message('after the execute_query',acknowledge);  -- to verify if code stil executes after previous statement
and
add a call to the counting function you made
(or did you  that already?)
0
 

Author Comment

by:hinamansoor
ID: 39735027
Thanks for reply i have already acomplished this task myself if you need i can post here

Regard
Hina mansoor
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 39735190
You can, or just delete the question.
0
 

Accepted Solution

by:
hinamansoor earned 0 total points
ID: 39736545
sure i have acomplished this task in this way and its successfully working


FUNCTION count_record (dept VARCHAR2) RETURN NUMBER
IS
  counter NUMBER;
BEGIN
  GO_BLOCK(dept);
  COUNT_QUERY;
  counter := GET_BLOCK_PROPERTY(dept, QUERY_HITS);
  IF FORM_SUCCESS THEN
    RETURN (counter);
 ELSE
    MESSAGE('ERROR BLOCK '||:SYSTEM.CURRENT_BLOCK);
    MESSAGE('ERROR BLOCK '||:SYSTEM.CURRENT_BLOCK);
    RAISE FORM_TRIGGER_FAILURE;
  END IF;
END;


and

 WHEN-BUTTON-PRESSED---TRIGGER


DECLARE
   counted NUMBER;
BEGIN
    counted:= count_Record('dept');
    GO_BLOCK('dept');
    EXECUTE_QUERY;
END;


hinamansoor
0
 

Author Comment

by:hinamansoor
ID: 39737541
I've requested that this question be closed as follows:

Accepted answer: 0 points for hinamansoor's comment #a39736545

for the following reason:

my question was I had two canvases (1 canvas having database block items ,2nd having control block items & FIND button also in Control block), My requirement is when i select any one of the lov and click on the find button(in 2nd canvas , control block canvas)
then it navigates to the database block canvas and displays records, at that time i had to display record count message.  which i have done by using above code


Hina mansoor
0
 
LVL 20

Expert Comment

by:flow01
ID: 39737054
Nice solution, thanks for sharing.
(The QUERY_HITS property I was not aware of)
0
 

Author Comment

by:hinamansoor
ID: 39737542
plz close this question i have acomplished this task successfully



Thanks
Hina mansoor
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Select and Insert Query running slow 4 58
Row_number in SQL 6 45
Oracle database T-1 Setup 7 26
Password_rules_securitty.. 12 33
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and theā€¦
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question