Solved

Record count on Database Block

Posted on 2013-12-21
10
622 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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

724 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