Home » Developer & Programmer » Forms » Current detail block in master detail form (Oracle Designer 9.0.4.4.8, Form Builder 9.0.4.1.0, Windows XP Professional)
Current detail block in master detail form [message #388863] Thu, 26 February 2009 07:44 Go to next message
scorpio4frenz
Messages: 48
Registered: October 2008
Member
I have a master-detail form with 1 master block called "companies" and 2 detail blocks, namely "in-transactions" and "out-transactions". The detail blocks are created using tabs. At any time, the master and one of the detail blocks is visible on the screen.

Both my detail blocks have a field called "transaction_type", which uses the "transaction_type" from the respective tables on which the blocks are based, and can have values "A","B", and "C". I have a button in the master saying "Create new type-A record". I'm trying to implement a functionality wherein when the user clicks that button, a new row with transaction_type = "A" should be created in the detail block that is currently on the screen. I know how to implement this for a single block once I know what block it is, but I'm getting stuck at the part where I need to determine which detail block I need to add the row to! I was initially thinking of using something like :system.cursor_block or :system.current_block but these will only give me the name of the master block since I will be in the master block when I click the button!

Can anyone provide any ideas?

I greatly appreciate any tips.
Re: Current detail block in master detail form [message #388865 is a reply to message #388863] Thu, 26 February 2009 07:51 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
One way would be to move that button onto the tab pages (which means that you'll have two of them, one for "in" and one for "out" transactions). Doing so, you'd be able to easily navigate to the desired block and create a new record.
Re: Current detail block in master detail form [message #388868 is a reply to message #388865] Thu, 26 February 2009 07:54 Go to previous messageGo to next message
scorpio4frenz
Messages: 48
Registered: October 2008
Member
Littlefoot,

Thanks for the quick response. Yes, that is the simplest option, but as far as possible I want only 1 button doing both. Also, I have some other buttons in the master block as well and it is aesthetically pleasing to put all the buttons together on the screen!!

Any other way?
Re: Current detail block in master detail form [message #388882 is a reply to message #388868] Thu, 26 February 2009 08:35 Go to previous messageGo to next message
scorpio4frenz
Messages: 48
Registered: October 2008
Member
I have fixed my problem for the time being, but I don't like the way yet. Still looking for a better way.

Right now, I'm using something like:

declare
curblk varchar2(30);

begin
curblk := get_canvas_property('canvas_tab_1',topmost_tab_page);

if curblk = 'canvas_tab_1_page_1' then
go_block('in_transactions');

.........do the thing......

elsif curblk = 'canvas_tab_1_page_2' then
go_block('out_transactions');

........do the thing.........

end if;
end;


I'm not too fond of having to explicitly hard-code the tab canvas names. It is not very friendly to look at.

Does anyone know any alternatives to this?

Thanks, once again, for any pointers.
Re: Current detail block in master detail form [message #388990 is a reply to message #388868] Thu, 26 February 2009 21:35 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Two buttons, one on each detail block, they both are positioned at the same place on the top canvas. They each have the same code
begin
  lp_add_detail(:system.current_block);
end
where 'lp_add_detail' is a procedure local to this form which goes to a detail block based on the input parameter and then adds the new record.

David
Re: Current detail block in master detail form [message #388992 is a reply to message #388990] Thu, 26 February 2009 21:44 Go to previous message
scorpio4frenz
Messages: 48
Registered: October 2008
Member
Djmartin, As I mentioned, I "need to" have only one button doing all the work, since it is possible to do that! Also, preferably, the button has to be in the master block with all the other buttons that do similar things. ! If you see my most recent post, I have found a way to do this using a single button. The only problem is that I have had to hard code the canvas names in it. I was looking for an alternative for that.

Thanks anyways for your input.

[Updated on: Thu, 26 February 2009 21:45]

Report message to a moderator

Previous Topic: Calendar Date and day in database
Next Topic: Webutil on client problem
Goto Forum:
  


Current Time: Fri Sep 20 12:28:15 CDT 2024