Home » Developer & Programmer » Forms » Multiple Data Blocks
Multiple Data Blocks [message #82768] Wed, 02 July 2003 06:21 Go to next message
Anil
Messages: 80
Registered: September 2001
Member
Hi,
I have two data blocks on my form. The Master block is based on a view of a table A and the Detail block is based on table A.
Now my problem is when I press a button Fetch Records, I want to populate the Detail block items with the records of another table B. So when I have it on this detail form, I could automatically save it on my Table A.

Please help
Re: Multiple Data Blocks [message #82782 is a reply to message #82768] Thu, 03 July 2003 06:23 Go to previous messageGo to next message
magnetic
Messages: 324
Registered: January 2003
Senior Member
block A1 [[view A]]
block B [[table B]]
block A2 [[remove this block of table A]]

make a relation between A1 and B
query the A1.
The B is also queried.
after the query is finished use a button to
insert the rows of the B block into table A
when-button-pressd trigger contains:
go_block('B');
first record;
v_first number:=:system.cursor_record;
last_record;
v_last number:= :system.cursor_record;
first_record;
while not :system_cursor_record=v_last loop
v_field1:=:b.field1;
v_field2:=:b.field2;
...
..
.
insert into table A
values(....)
commit;
v_field1:=''; -- reset the values of the variables
v_field2:='';

down;-- takes the next row
end loop;
commit;
[[remember this way the last record is not processed.. so after the loop, you should use the same way just for the last record.]]
Re: Multiple Data Blocks [message #82793 is a reply to message #82782] Sat, 05 July 2003 06:02 Go to previous message
Anil
Messages: 80
Registered: September 2001
Member
Hi magnetic,
Thx for the reply. But my problem is this.
I agree with the answer given. But how could one get the value of an item which on a different canvas.
Better still, how could one get the values of a tabular records on one canvas onto the items of a different canvas.
Eg.
We have two canvases each attached to a block resp., viz. A and B
Then when we are updating B which is a tabular canvas, we want the items' valuesof this canvas to automatically appear on the B, when we press a button or whatever.
I could do this for a single item on canvas B using
:A.item_name:=:B.item_name
But I could do this for all the items present on canvas B
Previous Topic: Deleting Records from Form...
Next Topic: Controlling child forms
Goto Forum:
  


Current Time: Wed Apr 24 16:59:57 CDT 2024