Home » Developer & Programmer » Forms » clear block (10g)
clear block [message #553625] |
Mon, 07 May 2012 05:51 |
|
kriti.akanksha
Messages: 28 Registered: March 2012
|
Junior Member |
|
|
when i press when button pressed trigger,i want first the form will delete all the previous data and then populate the data from the table, that's why i used clear_block first, but this clear_code is not working here. my coding is given below
go_block('show');
clear_block(NO_VALIDATE);
declare
cursor c1 is select *
from qtr_demand order by 1;
begin
go_block('show');
clear_block(no_validate);
open c1;
loop
fetch c1 into
-----------
exit when c1%notfound;
next_record;
end loop;
close c1;
first_record;
end;
|
|
|
|
|
Re: clear block [message #553634 is a reply to message #553631] |
Mon, 07 May 2012 06:55 |
|
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Quote:i have coding on when new form instace, so as i open the form it populates the data from table wihhout pressing any button
The same can be done as-- WHEN-NEW-FORM-INSTANCE trigger
execute_query;
Recalculate button? What does it do? Where are these calculations stored? Do you update the table (UPDATE your_table SET ...), or records in a form (:block.item := recalculated_value)? Whichever it is, it should look like
-- recalculate here
commit; -- or, possibly, "standard.commit;"
execute_query;
Saying that "it doesn't clear the block", what does it do, then? Nothing? Raises an error? If so, which one?
|
|
|
|
|
Re: clear block [message #553678 is a reply to message #553637] |
Mon, 07 May 2012 15:38 |
owais_baba
Messages: 289 Registered: March 2008 Location: MUSCAT
|
Senior Member |
|
|
I think dear you are trying to do something like that
GO_BLOCK('B');
clear_block(no_commit);
declare
cursor c1 is
select * from a WHERE NO=:A.NO ;
a_record c1%rowtype;
begin
open c1;
loop
fetch c1 into a_record;
exit when c1%notfound;
:b.no:=a_record.no;
:b.name:=a_record.name;
next_record;
--insert into b values(a_record.no,a_record.name);
end loop;
close c1;
end;
first_Record;
Hope your problem is solved
regards
baba
|
|
|
Re: clear block [message #554196 is a reply to message #553678] |
Fri, 11 May 2012 04:52 |
|
kriti.akanksha
Messages: 28 Registered: March 2012
|
Junior Member |
|
|
go_block('show');
clear_block(no_validate);
go_block('total');
clear_block(no_validate);
declare
cursor c1 is select distinct qtr_type, payfr, payto, stock, stock_gp, stock_dp, occupied, occupant, stock_sp, pr_vacancy, occupant_5cpc, eligible, eligible_wait
from qtr_demand order by 1;
t1 number := 0;
t2 number := 0;
t3 number := 0;
t4 number := 0;
t5 number := 0;
t6 number := 0;
t7 number := 0;
t8 number := 0;
t9 number := 0;
t10 number := 0;
begin
qtr_shortage;
open c1;
loop
fetch c1 into
:show.qtr_type,
:show.pay_fr,
:show.pay_to,
:show.total_hs,
:show.gp,
:show.dp,
:show.entitled,
:show.actual,
:show.stk_to_be_vac,
:show.pr_vac_stk,
:show.et_not_known,
:show.et_known,
:show.waiting;
exit when c1%notfound;
t1 := t1 + :show.total_hs;
t2 := t2 + :show.gp;
t3 := t3 + :show.dp;
t4 := t4 + :show.entitled;
t5 := t5 + :show.actual;
t6 := t6 + :show.stk_to_be_vac;
t7 := t7 + :show.pr_vac_stk;
t8 := t8 + :show.et_known;
t9 := t9 + :show.et_not_known;
t10 := t10 + :show.waiting;
next_record;
end loop;
close c1;
first_record;
go_block('total');
:total.total1 := t1;
:total.total2 := t2;
:total.total3 := t3;
:total.total4 := t4;
:total.total5 := t5;
:total.total6 := t6;
:total.total7 := t7;
:total.total8 := t8;
:total.total9 := t9;
:total.total10 := t10;
end;
in this form,i have 2 blocks show and total, one procedure qtr_shortage. this procedure executes and dump the data in qtr_demand table.the above coding is on recalculate button, when button pressed.
The problem is, that the CLEAR_BLOCK issued in the form doesn't seem to take effect (i.e. screen refresh). as the procedure takes some time to calculate data i want till that form erases its previous value and remains blank till execution of procedure.
|
|
|
|
Re: clear block [message #554374 is a reply to message #554198] |
Mon, 14 May 2012 00:52 |
|
kriti.akanksha
Messages: 28 Registered: March 2012
|
Junior Member |
|
|
go_block('show');
clear_block(no_validate);
go_block('total');
clear_block(no_validate);
go_block('SHOW');
execute_query;
begin
select distinct qtr_type, payfr, payto, stock, stock_gp, stock_dp, occupied,
occupant, stock_sp, pr_vacancy, occupant_5cpc, eligible, eligible_wait
into :show.qtr_type, :show.pay_fr, :show.pay_to, :show.total_hs, :show.gp, :show.dp,:show.entitled,
:show.actual, :show.stk_to_be_vac, :show.pr_vac_stk, :show.et_known, :show.et_not_known, :show.waiting
from qtr_demand order by 1;
end;
as you said to use execute_query, i did the same bt this is not working, no any data is coming from table to form.
|
|
|
|
|
|
|
|
|
|
Re: clear block [message #555077 is a reply to message #554577] |
Mon, 21 May 2012 04:00 |
|
kriti.akanksha
Messages: 28 Registered: March 2012
|
Junior Member |
|
|
why only the first message 'hello' is working, second message is not working.
declare
cursor c1 is select distinct qtr_type, payfr, payto, stock, stock_gp, stock_dp, occupied,
occupant, stock_sp, pr_vacancy, occupant_5cpc, eligible, eligible_wait
from qtr_demand order by 1;
begin
message('hello'); message('');
message('hi'); message('');
--qtr_shortage;
open c1;
loop
fetch c1 into
:show.qtr_type,
:show.pay_fr,
:show.pay_to,
:show.total_hs,
:show.gp,
:show.dp,
:show.entitled,
:show.actual,
:show.stk_to_be_vac,
:show.pr_vac_stk,
:show.et_not_known,
:show.et_known,
:show.waiting;
exit when c1%notfound;
next_record;
end loop;
close c1;
first_record;
end;
|
|
|
|
|
|
Re: clear block [message #556221 is a reply to message #554198] |
Fri, 01 June 2012 00:47 |
|
kriti.akanksha
Messages: 28 Registered: March 2012
|
Junior Member |
|
|
Begin
qry := 'select distinct qtr_type, payfr, payto, stock, stock_gp, stock_dp, occupied,
occupant, stock_sp, pr_vacancy, occupant_5cpc, eligible,eligible_wait
from qtr_demand order by 1';
set_block_property('qtr_demand', default_where, qry);
go_block('qtr_demand');
execute_query;
End;
i wrote this code, but this is not working. here qtr_demand is a batablock, based upon table qtr_demand.
|
|
|
|
|
Re: clear block [message #556234 is a reply to message #556232] |
Fri, 01 June 2012 01:42 |
|
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
In what query?
Data block is based on a table. If you just create it (using a wizard) and execute query, it would be the same as if you ran (in SQL*Plus)Obviously, you'd get ALL records from the table.
If you want to restrict them by some condition (for example, col_1 = 25), in SQL*Plus that would beselect *
from your_table
where col_1 = 25 In Forms, you can do that with SET_BLOCK_PROPERTY and its DEFAULT_WHERE, so you'd put it asset_block_property('block_name', default_where, 'col_1 = 25');
Once again: WHERE clause goes into DEFAULT_WHERE, not the whole SELECT statement.
|
|
|
Re: clear block [message #556245 is a reply to message #556234] |
Fri, 01 June 2012 03:28 |
|
kriti.akanksha
Messages: 28 Registered: March 2012
|
Junior Member |
|
|
i got it, as i haven't any restriction on selecting rows (cann't use where clause), so i am not able to use set_block_property in this form.
thanks.
but i have one another form in which data block is created by data wizard, based on table ol_registration. in this form coding is like this
Begin
if :control.REC_FROM is not null and :control.REC_TO is not null then
qry :=' RECD_ON between :control.REC_FROM and :control.REC_TO '; set_block_property('ol_registration', default_where , qry );
go_block('ol_registration');
execute_query;
end if;
this is working fine, but through this i also get duplicate records in this. i want distinct records only, so i modify this like this
Begin
if :control.REC_FROM is not null and :control.REC_TO is not null then
qry := ' select distinct form_no, edt, regno, name, desgn, form_status, recd_on
from ol_registration_vu where RECD_ON between :control.REC_FROM and :control.REC_TO'; set_block_property('ol_registration', default_where , ' RECD_ON between :control.REC_FROM
and :control.REC_TO ' );
go_block('ol_registration');
execute_query;
end if;
but this coding is not retrieve data from database, it is not doing anything.
how can i get distinct records only.
|
|
|
|
Goto Forum:
Current Time: Thu Sep 19 02:58:05 CDT 2024
|