Re: Forms 4.5 Commit Validation

From: Mario Zgela <mario_at_hnb.hr>
Date: 11 Jan 1999 14:56:03 GMT
Message-ID: <01be3d73$51a2a6e0$236faaaa_at_mzgela>


Hi Ivan!

Maybe it's better solution to do calculation before commit time, during the validation.
So, create when-new-record-instance trigger in master block with following code:

:global.part_sum:=0;

Create following when-validate-item trigger for detail block item that holds the value (e.g. detailed_block.value):

:global.part_sum:=:global.part_sum + :detailed_block.value; if :global.part_sum>:master_block.value then :global.part_sum:=:global.part_sum - :detailed_block.value; raise form_trigger_failure;
end if;

Create following when-remove-record trigger for detail block:

:global.part_sum:=:global.part_sum - :detailed_block.value;

I didn't try this, but I think it should work. If not, small corrections will solve the problem.

Bye,
Mario

rkajda <rkajda_at_ComArch.pl> wrote in article <3699D3FF.F614A023_at_ComArch.pl>...
> Hi
> I'm affraid that it's not easy sollution of your problem and
sollution can
> depend on specific of your form. But you can try this:
> in pre-commit trigger (detailed block level or form level)
> :global.part_sum := '0';
> in pre-update and pre-insert triggers (detailed block level)
> :global.part_sum := to_char( to_number( :global.pat_sum ) +
> :detailed_block.value );
>
> if( to_number( :global.part_sum ) > :master_block.value )then
> Raise Form_Trigger_Failure;
> end if;
>
>
> Idwi wrote:
>
> > Hi All,
> >
> > I got this problem, I have a master detail form, where there is a
numeric
> > field in master block containing amount that is entered by users. And
then
> > the users also enter the distribution of that amount in detail block.
Before
> > committing, I want to check whether the sum of the distribution (in
detail)
> > is equal to the amount in master.
> > I've tried using PRE-COMMIT trigger and using go_block command to go to
> > detail block (to sum the amount) but Forms said it's a restricted
procedure,
> > so I can't use it in PRE-COMMIT. What trigger that I can use instead of
> > PRE-COMMIT ?
> >
> > Thanks for any reply.
> >
> > Regards,
> > Ivan D.
>
Received on Mon Jan 11 1999 - 15:56:03 CET

Original text of this message