Solved

Oracle Forms 6i: Delete Record Method

Posted on 2003-11-03
6
7,577 Views
Last Modified: 2009-11-25
I have a form that contains records from a table.  The records are displayed:

   field x             field y            field z
   data x             data y            data z
   data x2           data y2           data z2
   ...

I want to give the user the ability to delete one or more records on the table.  I have done this on other database form systems by putting a "check box" in front of each record.  If the user wants the record deleted, they select the checkbox.  When they hit the "Save" button, the application removes all records where the checkbox has been checked.

Any ideas on how to do this or something similar??
0
Comment
Question by:DCCoolBreeze
  • 3
  • 2
6 Comments
 
LVL 15

Accepted Solution

by:
andrewst earned 500 total points
ID: 9671950
You can do that.  Add the checkbox as a non-base-table item.  Then in the KEY-COMMIT trigger you can navigate through the records and delete the checked ones like this:

GO_RECORD(1);
LOOP
  IF :block.delete_flag = 'Y' THEN
    DELETE_RECORD;
  END IF;
  EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
  NEXT RECORD;
END LOOP;
COMMIT_FORM;
0
 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9672200
OK.  Great.  How do I get the checkbox to display one checkbox for each record in the form?
0
 
LVL 15

Expert Comment

by:andrewst
ID: 9672313
Put the checkbox in the same block as the records, and with property Number of Item Displayed = 0
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 1

Author Comment

by:DCCoolBreeze
ID: 9672387
Got error:

FRM-30174: Checked and Unchecked check box values must be distinct.
Check Box CHK_DELETE
Item: CHK_DELETE
Block: NX_AP_VAD_UNITS_OF_MEASURE
Form: NX_UOM
FRM-30085: Unable to adjust form for output.

0
 
LVL 15

Expert Comment

by:andrewst
ID: 9672483
When you define a checkbox item you must populate these properties with distinct values:

Value when checked
Value when not checked

For example, Y and N, or 1 and 0
0
 
LVL 1

Expert Comment

by:mlbustos
ID: 25910164
PROCEDURE DELREC IS

BEGIN
GO_BLOCK('PSUM_DISTN');
FIRST_RECORD;
LOOP
 IF :block.delete_flag = 'Y' THEN
    DELETE_RECORD;
ELSE
    NEXT_RECORD;
END IF;    

IF :SYSTEM.LAST_RECORD = 'TRUE' THEN
 IF  IF :block.delete_flag = 'Y' THEN
    DELETE_RECORD;
 END IF;
 EXIT;
END IF;
END LOOP;
do_key('commit_form');
 
END;
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now