Solved

Record count on Database Block

Posted on 2013-12-21
10
610 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
  • 4
  • 2
  • 2
10 Comments
 
LVL 37

Expert Comment

by:Gerwin Jansen
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
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 39735190
You can, or just delete the question.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
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 video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now