Populating form with calculated values [message #472325] |
Thu, 19 August 2010 21:49 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
coolguy01
Messages: 64 Registered: August 2006
|
Member |
|
|
I have a form in which the fields are calculated fields. So i need to populate the form after calculating the values based on a database columns. For example if i have a table as below
COL A | Col B | Col C | Col D
2 3 4 5
3 4 5 6
I have 3 fields on my form which i need to poplate such that field1 maps to col A. Field2 value is COL B * COL D for that value of COL A. Field 3 value is COLB * COL D for that value of col A.
I tried somethin like this
PROCEDURE NAME IS
cursor c1 is SELECT * FROM TABLEL;
begin
go_block('Block1');
clear_block(no_validate);
for i in c1 loop
:BLOCK.field1 := i.COL_A;
:BLOCK.field2 := i.COL_B * i.COL_C;
:BLOCK.field3 := i.COL_C * i.COL_D;
next_record;
end loop;
last_record;
end;
this fetched all the records for field1 but for field2 and field3 it only calculates and populates the field row. Please advice.
|
|
|
Re: Populating form with calculated values [message #472349 is a reply to message #472325] |
Fri, 20 August 2010 02:05 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
coolguy01 wrote on Fri, 20 August 2010 03:49this fetched all the records for field1 but for field2 and field3 it only calculates and populates the field row.
Not sure what that means.
Just base the the block on the table and use the post-quer trigger to calculate the values.
Or you could crate a view that does the calculations for you and base the block on that.
|
|
|