This discussion is archived
5 Replies Latest reply: Apr 21, 2010 3:19 PM by CraigB RSS

Choosing the records to save in a database based block

549106 Newbie
Currently Being Moderated
Hi everybody,

I'm working with oracle 10g forms builder, I have a database based block.. in which I'll populate a number of records retrieved from a cursor. In that block, I have a non database item which a checkbox.
The user can select the records he wants to save by setting the checkbox to check.

Only the selected records should be checked.

Can anyone please help me implementing that.

Thanking you all in advance.

Cheers.
  • 1. Re: Choosing the records to save in a database based block
    FrançoisDegrelle Oracle ACE
    Currently Being Moderated
    One thing that you can do is to create 3 triggers on your block:

    - ON-INSERT
    - ON-UPDATE
    - ON-DELETE

    Then look if the checkbox is checked;:

    example with ON-INSERT:
      If :block.check = 1 Then
        Insert_record ;
      End if ;
    Francois
  • 2. Re: Choosing the records to save in a database based block
    Andreas Weiden Guru
    Currently Being Moderated
    I have a database based block.. in which I'll populate a number of records retrieved from a cursor
    In general these two are mutual exclusive. Either you base your block on a database table/view, or you populate it by using a cursor. So, what way do you use?
  • 3. Re: Choosing the records to save in a database based block
    549106 Newbie
    Currently Being Moderated
    The source of the block is based on a table.

    The block is a multi record block, what I intend to do is to insert some records from a cursor into that block, then after the process of populating is complete, I'll save those records in the table.

    Rgds,

    Amlesh
  • 4. Re: Choosing the records to save in a database based block
    CraigB Guru
    Currently Being Moderated
    Commit processing in Forms is an all or nothing process. You cannot pick and choose which records will be commited during a Commit_Form or Commit call. Based on your description, I don't see why you would need to use the checkbox to keep track of which records are new since you state that you add the records through a cursor and then to save them. Forms already keeps track of which records were queried into a block and which records are new so a simple call to Commit_Form will accomplish what you want without the need to manually keep track of which records are new.

    Hope this helps,
    Craig

    If a response is helpful or correct, please mark it accordingly.
  • 5. Re: Choosing the records to save in a database based block
    CraigB Guru
    Currently Being Moderated
    With respects to my previous post, I have recently learned that you can actually perform the kind of COMMIT processing you are attempting by using the On-Insert trigger. You can perform your test of the CheckBox and call the Insert_Record built-in if the test passes. For example:
    /* On-Insert Trigger */
    BEGIN
       IF ( :MY_BLOCK.CHECK_BOX = 'Y' ) THEN 
          Insert_Record;
       END IF;
    END;
    Sorry for any confusion.
    Craig...

    Edited by: CraigB on Apr 21, 2010 4:17 PM

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points