Home » Developer & Programmer » Forms » master detail problem (Oracle Forms 6i)
master detail problem [message #661098] Tue, 07 March 2017 08:53 Go to next message
flanoriko
Messages: 6
Registered: March 2017
Junior Member

Hello everybody!

I created a form with a master and two detail tables. All these blocks are view based... and one of these views has two tables joined.
I used the wizard to create the relations, but the behaviour is strange... when I create a record in the master block, the first detail block is cleared... but the second
detail block is not... And if I create the second relation first and then the other, they change the behaviour... The second detail block is cleared and the first is not.

I have no clue how to resolve this... I put some "clear_block" in the "on populate details"... but I think it is not safe.

Can anybody help me?

Tks
Re: master detail problem [message #661099 is a reply to message #661098] Tue, 07 March 2017 12:34 Go to previous messageGo to next message
joy_division
Messages: 4949
Registered: February 2005
Location: East Coast USA
Senior Member
That's not really much to go on.

Did you use the wizard to only create the relations or everything?

Maybe you can show the relation and where they are on the object navigator.
Re: master detail problem [message #661106 is a reply to message #661099] Tue, 07 March 2017 15:38 Go to previous messageGo to next message
Littlefoot
Messages: 21599
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You might need to manually add a condition to the (second detail block's) relationship created by the Wizard in order to make it work.
Re: master detail problem [message #661112 is a reply to message #661106] Wed, 08 March 2017 05:22 Go to previous messageGo to next message
flanoriko
Messages: 6
Registered: March 2017
Junior Member

Hi!
I tested and found a loop on the clear_all_master_detail that is not passing through all relations ... It passes by the two detail blocks if I click twice on the create_record button. Like a Manual loop... hahah

So... I put some "clear block" in the code like this:
/*Original loop on the clear_all_master_detail: */
--
-- Clear all the detail blocks for this master without
-- any further asking to commit.
--

currel := get_block_property(trigblk,
first_master_relation);
WHILE currel IS NOT NULL
LOOP
curdtl := get_relation_property(currel,
detail_name);
IF get_block_property(curdtl,
status) <> 'NEW' THEN
go_block(curdtl);
check_package_failure;
clear_block(no_validate);
IF :system.block_status <> 'NEW' THEN
RAISE form_trigger_failure;
END IF;
END IF;
currel := get_relation_property(currel,
next_master_relation);
END LOOP;

/*Customized code*/
IF get_block_property(curdtl, status) = 'NEW' THEN
IF mastblk = 'MASTER_BLOCK1' THEN

go_block('DETAIL_BLOCK_1');
check_package_failure;
clear_block(no_validate);

go_block('DETAIL_BLOCK_2');
check_package_failure;
clear_block(no_validate);
END IF;
END IF;

That worked, but I dont know why the first loop did not...Do you have any clue?
Re: master detail problem [message #661115 is a reply to message #661112] Wed, 08 March 2017 05:48 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
Maybe:
currel := get_relation_property(currel,
next_master_relation);
should be
currel := get_relation_property(currel,
next_detail_relation);

I'm not in a position to test. You could add alerts to see what both those properties return.
Re: master detail problem [message #661116 is a reply to message #661115] Wed, 08 March 2017 06:08 Go to previous messageGo to next message
flanoriko
Messages: 6
Registered: March 2017
Junior Member

Hi CookieMonster!

I tested with alerts...but it didn´t work.

Tks!
Re: master detail problem [message #661118 is a reply to message #661116] Wed, 08 March 2017 06:20 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
So what do those properties return?
Re: master detail problem [message #661121 is a reply to message #661118] Wed, 08 March 2017 06:48 Go to previous messageGo to next message
flanoriko
Messages: 6
Registered: March 2017
Junior Member

Nothing.

  currel := get_block_property(trigblk,
                               first_master_relation);
  WHILE currel IS NOT NULL
  LOOP
    curdtl := get_relation_property(currel,
                                    detail_name);
    IF get_block_property(curdtl,
                          status) <> 'NEW' THEN
      go_block(curdtl);
      check_package_failure;
      clear_block(no_validate);
      IF :system.block_status <> 'NEW' THEN
        RAISE form_trigger_failure;
      END IF;
    END IF;
    
   -- currel := get_relation_property(currel,next_master_relation);
   currel := get_relation_property(currel,next_detail_relation);
   message(' currel '||currel);
  END LOOP;

[Updated on: Wed, 08 March 2017 06:48]

Report message to a moderator

Re: master detail problem [message #661122 is a reply to message #661121] Wed, 08 March 2017 07:15 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
What does currel get set to at the start?
Re: master detail problem [message #661130 is a reply to message #661122] Wed, 08 March 2017 08:37 Go to previous messageGo to next message
flanoriko
Messages: 6
Registered: March 2017
Junior Member

Ah!
I´ve found it. There was another relation in the forms in another master-detail and, because the name of the blocks are similar, the relations were created with the same names, but in different blocks. Then, "get_relation_property(currel,next_detail_relation);" got the detail of the other master!!
I just renamed the relations, and it worked. HAHAH
I can remove my customization! hahaha

Tks for the help.
Re: master detail problem [message #661131 is a reply to message #661130] Wed, 08 March 2017 08:52 Go to previous messageGo to next message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
You've got more than one set of related datablocks in the same form?
<<shudders>>

I'm surprised forms allows multiple relationships with the same name, but fair enough. Would have assumed it'd tack a number on the end of the 2nd one to avoid name collision.
Re: master detail problem [message #661132 is a reply to message #661131] Wed, 08 March 2017 09:04 Go to previous messageGo to next message
flanoriko
Messages: 6
Registered: March 2017
Junior Member

hahaha, yeah...it is a monster form. ahhaha
Yes... I tried everything.. and it was a simple error, generated by the oracle forms Very Happy .

but, well, thanks again.

[Updated on: Wed, 08 March 2017 09:05]

Report message to a moderator

Re: master detail problem [message #661133 is a reply to message #661132] Wed, 08 March 2017 09:20 Go to previous message
cookiemonster
Messages: 13894
Registered: September 2008
Location: Rainy Manchester
Senior Member
Glad you got to the bottom of it.
Previous Topic: Do you want to save changes is gone
Next Topic: How to disable printscreen key in forms10
Goto Forum:
  


Current Time: Thu Oct 01 12:30:07 CDT 2020