Solved

programatically List Item problem

Posted on 2004-09-25
2
482 Views
Last Modified: 2013-12-12
I have list item and following code at form level 's "When - new - form - instance"

DECLARE
          CURSOR C1 IS  SELECT distinct remarks FROM stock where remarks is not null;
          LV_dname      stock.remarks%type;
          LN_count      NUMBER := 1;
          list_id          ITEM;
     BEGIN
          list_id := Find_Item( 'remarks' );
          OPEN C1;
          LOOP
               FETCH C1 INTO LV_Dname;
               EXIT WHEN C1%NOTFOUND;
               Add_List_Element( list_id, LN_count,
                    LV_dname,  LV_dname);
               LN_count := LN_count + 1;
          END LOOP;
          CLOSE C1;
     END;

The code is fine and worked but it creates duplicate rows when I insert more than one record in the same session. I use this with when new record instance and when new item instance but the problem is same that after first record inserted it shows duplicate and then tripplicate and so so records as it picks every time the values from the database and included in the existing records. I want if I put this trigger at 'when new record instance' then it collects data from the database only for newer values not for each and every value.

Suppose there are two values in the remarks.
LOOM
LOOM2

At first time when I loaded the form it shows these two values but when i select one of these and save. The next time( in the same session with out exiting the form) it shows
LOOM
LOOM2
LOOM
LOOM2

I want to eliminate this duplication.

I hope you understand this
0
Comment
Question by:neeha
2 Comments
 
LVL 1

Accepted Solution

by:
Kagiejot earned 250 total points
ID: 12154023
Probably you forgot about CLEAR_LIST routine.

DECLARE
  list_id       ITEM;
  LN_count      NUMBER := 1;
CURSOR C IS
  SELECT distinct remarks FROM stock where remarks is not null;
BEGIN
  list_id := FIND_ITEM ('block_name.remarks');
  CLEAR_LIST('block_name.remarks');
  FOR C_REC IN C LOOP
    add_list_element(Item_ID, LN_count, C_REC.REMARKS, C_REC.REMARKS);
    LN_count := LN_count + 1;
  END LOOP;
END;

Good Luck
0
 

Author Comment

by:neeha
ID: 12156787
oh God thanks Kagiejot ,

I definately forgot the clear_list, I tried several times using clear_item. But millions of thanks for helping me.

Thanks again

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

Title # Comments Views Activity
Parametric query in oracle 6 51
Migrate database to ASM disks. 1 39
Get the parent node - XMLTYPE 9 56
PL/SQL Display based on value 4 19
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…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
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.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.

910 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

20 Experts available now in Live!

Get 1:1 Help Now