Solved

Record count on Database Block

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Join SQL view with APEX item as the join condition 4 47
JDeveloper 12c for 32 bit 4 68
Getting TNS:Connect timeout occurred while opening the application 5 56
oracle 11g 23 48
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…
Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

911 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

16 Experts available now in Live!

Get 1:1 Help Now