Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Record count on Database Block

Posted on 2013-12-21
10
Medium Priority
?
624 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
Industry Leaders: 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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 …
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to recover a database from a user managed backup

618 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