Solved

Oracle Forms 6i: Delete Record Method

Posted on 2003-11-03
6
7,974 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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

786 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