Home » Developer & Programmer » Forms » Record count on Database Block
Record count on Database Block [message #603741] Thu, 19 December 2013 01:11 Go to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
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.

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;


And also i have written Get_block_property on function also

Thank You
Re: Record count on Database Block [message #603767 is a reply to message #603741] Thu, 19 December 2013 04:29 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
on-count--trigger is ok

take example fmb its simple
Re: Record count on Database Block [message #603769 is a reply to message #603767] Thu, 19 December 2013 04:33 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi mughals_king,

Thanks for reply.I have 2 blocks , so, where can i create 2 items(total_record, current_record) , i mean on control block?. I want to display the records of the database block records.

Thank you
Re: Record count on Database Block [message #603786 is a reply to message #603769] Thu, 19 December 2013 07:15 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
Yes create items in control block like "tot_rcds" & "current_Record"


--when-new-forms-instance---trigger

:control.current_record := :System.Trigger_Record;
BEGIN
   GO_BLOCK('dept');
   COUNT_QUERY;
:control.tot_rcds := GET_BLOCK_PROPERTY('dept', QUERY_HITS);
   EXECUTE_QUERY;
END;



Regard
Mughal
Re: Record count on Database Block [message #603788 is a reply to message #603786] Thu, 19 December 2013 07:24 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
take screen shot
Re: Record count on Database Block [message #603789 is a reply to message #603786] Thu, 19 December 2013 07:33 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi Mughal,

1) i have 2 blocks(1 database, 1 is control block)
2) contol block having 5 items, created lov & 1 find button
3) 2 canvas for 2 blocks
4) i select any one of the lov(from the control canvas) , click on the find button, it shows database canvas
& displays table records
5) at that time i want to pop-up message at the database canvas(2nd canvas) , not pop-up at the control block canvas

I want to pop-up the message on the database canvas.Please suggest , i don't want put current_record ,total_record

/forum/fa/11458/0/

Thank You


[EDITED by LF: fixed [img] tags]
  • Attachment: image1.png
    (Size: 31.57KB, Downloaded 7330 times)

[Updated on: Thu, 19 December 2013 13:36] by Moderator

Report message to a moderator

Re: Record count on Database Block [message #603844 is a reply to message #603789] Thu, 19 December 2013 13:44 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
ok then try this

Re: Record count on Database Block [message #603845 is a reply to message #603844] Thu, 19 December 2013 13:46 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
take screen shot
Re: Record count on Database Block [message #603846 is a reply to message #603845] Thu, 19 December 2013 14:18 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
Take little clear picture used 2 blocks/canvases

[Updated on: Thu, 19 December 2013 14:20]

Report message to a moderator

Re: Record count on Database Block [message #603859 is a reply to message #603846] Fri, 20 December 2013 00:24 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi Mughal,

Thank you for reply,I used form, it directly navigates to the data block canvas , when i am not selecting any lov's please see the below screen shot.

/forum/fa/11465/0/
Control Bolck:
--------------
1)WNB Trigger
DECLARE
   CNT NUMBER;
BEGIN 
  	--GO_BLOCK('Blockname'); -->Database Block Name
   CNT:=count_record('Blockname');
   --EXECUTE_QUERY;
END;
   
Find Button:
-----------
Go_Block('Blockname')  -->Database Block Name
execute_query();
  • Attachment: image1.png
    (Size: 22.99KB, Downloaded 7215 times)
Re: Record count on Database Block [message #603916 is a reply to message #603846] Fri, 20 December 2013 05:29 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi Mughal,

and also i wrote below code in find button & i select lov ,click on the find button it pop-up message "You have 200 records",but not display Record count like Record:1/?,2/? etc..

LAST_RECORD;  
      message('There are ' || :SYSTEM.CURSOR_RECORD || ' records in this block');  
      message('There are ' || :SYSTEM.CURSOR_RECORD || ' records in this block');  
      FIRST_RECORD;  

      Execute_query(); 



Thank You
Re: Record count on Database Block [message #603925 is a reply to message #603846] Fri, 20 December 2013 06:51 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi Mughal,

Your form worked on form builder not in Oracle apps server.

Thank You
Re: Record count on Database Block [message #603933 is a reply to message #603925] Fri, 20 December 2013 08:21 Go to previous message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
I really Did not exactly tested in App. server enviroment. BUT it should work

keep same function and put this code in

----WHEN-BUTTON-PRESSED----

DECLARE
   counted NUMBER;
BEGIN

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



see screen shot after clicking OK it will enter in next_block

Regard
Mughal


[Updated on: Fri, 20 December 2013 08:22]

Report message to a moderator

Previous Topic: Installing application in windows 7 using Oracle Form 6i
Next Topic: oracle form 10g error
Goto Forum:
  


Current Time: Fri May 17 00:38:36 CDT 2024