Re: Working with multi-row blocks in Forms 4.5

From: OEM <sparmanand_at_msn.com>
Date: 1997/07/10
Message-ID: <01bc8d80$7e741b80$9c1b2299_at_default>#1/1


This is the first thing that came to my mind, so may not be the greatest and the best solution.

Define a non canvas field in a control block to store the record number of the record that is checked. (lets call it ti_checked_rec_no)
Write a when-checkbox-changed trigger.
The trigger contents should fire only when the checkbox state changes from unchecked to checked (other wise control may go in a loop)
do the following in the trigger
-- when the check box is checked it will store the current record number

   to a trigger variable (say l_rec_no)
-- Check the value of ti_checked_rec_no

   IF NULL THEN             -- no other record is checked
       :control.ti_checked_rec_no := l_rec_no;
   ELSE
       Go_Record(:control.ti_checked_rec_no );
       is_current := 'N';    -- N is unchecked value, Y is checked value.
                                    -- Unchecking will fire the when check
box fchanged trigger but will do nothing
       :control.ti_checked_rec_no := l_rec_no;
        Go_Record(l_rec_no );   -- bring the cursor back to the last record
that was checked

   END IF;

  • This logic will not allow more than one record to be checked at a time.

I have not tried this out, let me know how it works out.

Hope this helps.

Santosh
sparmanand_at_msn.com

Michael Anderson <manders_at_access.mbnet.mb.ca> wrote in article
<33c50590.11355306_at_news.mbnet.mb.ca>...

> I have a form with a multi-record block. One of the fields of this
> block is a checkbox. For the blocke's underlying table the column's
> name is IS_CURRENT. One of the business rules regarding this table is
> up to one record can be current (ie checked on the form).
>
> Using a trigger, can I look at each instance of the IS_CURRENT field
> on the form to determine if one is checked? Using a select against
> the table itself does not work because the user could have unchecked
> the checked record and not committed her changes.
>
> Example Form:
>
> BLOCK
> Key value Current
> [KEY 1] [ ]
> [KEY 2] [ ]
> [KEY 3} [x]
> END OF BLOCK
>
> When the user clicks on KEY 1's current checkbox I want a trigger to
> look at KEY 2's and KEY 3's current checkbox to determine if one of
> those values is checked.
>
> I hope my question makes sence and I hope someone can help me.
> Thanks!
>
Received on Thu Jul 10 1997 - 00:00:00 CEST

Original text of this message