Home » Developer & Programmer » Forms » Scrolling up the query data
Scrolling up the query data [message #676779] Tue, 16 July 2019 03:18 Go to next message
vraghul86@gmail.com
Messages: 11
Registered: December 2017
Junior Member
i want scrolling up details like, DOno, name, salesman, qty from cursor on oracle form as like:
when i open a new form then cursor details move up like scrolling up.when cursor last record then repeat again this process.
how it can possible using when timer expired trigger. can any one help me please. i hope all of you understood my requirement.
Re: Scrolling up the query data [message #676780 is a reply to message #676779] Tue, 16 July 2019 05:10 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Here's an option that doesn't use a timer, but utilizes dbms_lock.sleep procedure.

Suppose you created a form on Scott's EMP table (so, by default, block name is EMP). WHEN-NEW-FORM-INSTANCE trigger then looks like this:

begin	
  -- Initialize the block
  go_block('emp');
  execute_query;
  first_record;

  -- An infinite loop through all rows in the block
  loop
    if :system.last_record = 'TRUE' then
       first_record;
    else
       next_record;
       dbms_lock.sleep(1);    -- pause a second
    end if;
    synchronize;              -- without it, you won't see anything happen
  end loop;
end;
Re: Scrolling up the query data [message #676781 is a reply to message #676780] Tue, 16 July 2019 06:57 Go to previous messageGo to next message
vraghul86@gmail.com
Messages: 11
Registered: December 2017
Junior Member
Dear Littlefoot,

i have tried your coding its working fine.but, when i exit from the form its hanging.



Thanks & Regards,
Raghul

[Updated on: Tue, 16 July 2019 06:58]

Report message to a moderator

Re: Scrolling up the query data [message #676788 is a reply to message #676780] Tue, 16 July 2019 07:44 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
The trouble with your infinite loop LF is that it is one.

You want that navigation code in when-timer-expired.
Re: Scrolling up the query data [message #676792 is a reply to message #676788] Tue, 16 July 2019 08:03 Go to previous messageGo to next message
vraghul86@gmail.com
Messages: 11
Registered: December 2017
Junior Member
Dear cookiemonster,

Could you please give sample code then i can understand it easily.

The below code i have written in new_form_instance trigger
---------------------------------------------------------
begin
-- Initialize the block
go_block('do_sample');
execute_query;
first_record;

-- An infinite loop through all rows in the block
loop
if :system.last_record = 'TRUE' then
first_record;
else
next_record;
dbms_lock.sleep(0.5); -- pause a second
end if;
synchronize; -- without it, you won't see anything happen
end loop;
end;
Re: Scrolling up the query data [message #676802 is a reply to message #676792] Wed, 17 July 2019 10:31 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
Warning - untested

In when-new-form-instance:
DECLARE

  v_timer TIMER;
  
BEGIN  
  -- Initialize the block
  go_block('do_sample');
  execute_query;
  first_record;
  v_timer := Create_Timer('MYTIMER', 1000, REPEAT); --runs every second, change as appropriate

END;
In when-timer-expired:
DECLARE

  v_timer TIMER;
  
BEGIN
  
  v_timer := Find_Timer('MYTIMER');
  
  If NOT ID_NULL(v_timer) THEN
    
    IF :system.last_record = 'TRUE' THEN
      
      first_record;
      
    ELSE
      
      next_record;
      
    END IF;
    
    synchronize; -- without it, you won't see anything happen
    
  END IF;
  
END;
Re: Scrolling up the query data [message #676803 is a reply to message #676802] Thu, 18 July 2019 00:58 Go to previous messageGo to next message
vraghul86@gmail.com
Messages: 11
Registered: December 2017
Junior Member
Dear cookiemonster,

Thanks a lot. It's working perfectly.




Thanks & Regards,
Raghul V
Re: Scrolling up the query data [message #676831 is a reply to message #676802] Sat, 20 July 2019 06:37 Go to previous messageGo to next message
vraghul86@gmail.com
Messages: 11
Registered: December 2017
Junior Member
Dear Cookiemonster,

I have one more doubt how to change the back ground color only cursor_record rows.I had tried it in When-New-Record-instance trigger with the following query.

I have tabular block with 15 records displaying.

----------------
BEGIN
--if :System.Cursor_record=2 then
--message(:System.Cursor_record);pause;
--Set_Item_Instance_Property( :System.Cursor_record,CURRENT_RECORD_ATTRIBUTE, VISUAL_ATTRIBUTE,'v1');
set_item_property ('slno',CURRENT_RECORD_ATTRIBUTE,'v1');
--set_item_property ('slno',CURRENT_RECORD_ATTRIBUTE,'v1');
set_item_property ('dono',CURRENT_RECORD_ATTRIBUTE,'v1');
set_item_property ('vesl',CURRENT_RECORD_ATTRIBUTE,'v1');
set_item_property ('cust_name',CURRENT_RECORD_ATTRIBUTE,'v1');
set_item_property ('salman',CURRENT_RECORD_ATTRIBUTE,'v1');
set_item_property ('etadt',CURRENT_RECORD_ATTRIBUTE,'v1');
set_item_property ('port',CURRENT_RECORD_ATTRIBUTE,'v1');
set_item_property ('dis_status',CURRENT_RECORD_ATTRIBUTE,'v1');
--end if;
END;
Re: Scrolling up the query data [message #676832 is a reply to message #676831] Sat, 20 July 2019 08:24 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Use SET_ITEM_INSTANCE_PROPERTY instead.
Re: Scrolling up the query data [message #676833 is a reply to message #676832] Sat, 20 July 2019 08:27 Go to previous messageGo to next message
vraghul86@gmail.com
Messages: 11
Registered: December 2017
Junior Member
Dear Littlefoot,

Thanks.




Regards,
Raghul V
Re: Scrolling up the query data [message #676836 is a reply to message #676833] Sat, 20 July 2019 15:16 Go to previous message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You're welcome.
Previous Topic: Lov for Multiple items
Next Topic: export to excel
Goto Forum:
  


Current Time: Fri Mar 29 09:20:23 CDT 2024