Alert to be fired only for first record when duplicate entries exist

Hello,
This is related to Oracle forms 10g.
I have a multi record block wherein I am entering and storing some codes, something like below
Code Description
=====================
ABCD AAAAAAAAAAAA
PQRS BBBBBBBBBBBBB
DDDD SSSSSSSSSSS
ABCD DHGFKSDHKSHG
PQRS DFJHHGS
EEEE SDT85604ET
=====================
Now I need to display an alert/msg from when-validate-item of the Code field. So now if I am on first record, the alert/msg will be displayed for code ABCD which is Ok. Now on next record I enter a different code PQRS as given above, the alert will again be displayed which is Ok. If I enter a code which was previously entered in the multi record block and alert/msg had been displayed at that first time, the alert/msg need not be displayed now again i.e. if I enter ABCD again in fourth record, the alert should not be displayed.
Note that this need to be done at the data entry time itself. I guess may be it can be done using record groups/ plsql table.
Any help with a way to solve this issue will be highly appreciated..
Thanks and Regards...

As you have already guessed, you have to be able to keep track of how many times a value has been entered. If you know what all of the possible "CODE" values are at design-time, you could create a counter variable for each value, but this would be a total pain. A better solution would be to keep a dynamic running total that you can quickly check against. For this I recommend you use a Forms Record Group. Take a look at the Forms - Record Group Processing (Duplicate Value Checking) demo I wrote. Using the Forms Rec_Group package provided in this demo, you could easly modify the process listed in the document to work in your scenario. Follow all of the steps in the demo. For your situation, you will need to modify the When-Validate-Item trigger so that instead of checking for dupicates and failing the form if a duplicate is found, you will check the number of entries for a value in the record group and display a message if the count is 0 or not display a message if the count is greater than 0. Your modified WVI trigger might look like this:
DECLARE
   ignore     NUMBER := 0;
   bignore   BOOLEAN := FALSE;
BEGIN
   IF ( :YOUR_BLOCK.CODE IS NOT NULL ) THEN
      ignore := Rec_Group.Get_Number(Rec_Group.rg_name, :YOUR_BLOCK.CODE);
      IF ( ignore = 0 ) THEN
          -- Display your message
      ELSE
          -- Don't display any message
      END IF;
      /* add the code to the record group */
      bIgnore := Rec_Group.Add_Value(rec_group.rg_name, :YOUR_BLOCK.CODE, :system.trigger_record);
   END IF;
END;Hope this helps,
Craig B-)
If someone's response is helpful or correct, please mark it accordingly.
Edited by: CraigB on Mar 30, 2011 3:07 PM

Similar Messages

  • How to get Value of a item of first record when current record is second

    How to get Value of a item of first record when current record is second in Form6i ?
    get_item_instance_property dose not allow to get value.

    Gerd,
    You're right, there are several other triggers that must be coded, but I was responding to Steve's statement about Inserting or deleting records from the multi-record block. For the record, I use the following to manage a Record Group:
    * When-New-Block-Instance - Initialize the RG
    * block Post-Query - populate the RG
    * When-Create-Record - add new record to RG
    * When-Remove-Record - remove record from RG
    * block When-New-Item-Instance - capture previous value of the item or row
    * When-Validate-Item - Item specific Insert, Update, Delete of values in the RG
    There are a few other places as well, but these are the minimum. It might seem like a lot of code, but then again, I don't use this solution for every multi-line block. Like all tools, you use the right tool for the job. :-)
    Craig...

  • What should I do to setup a new MacBook pro for first time when moving from a PC?

    What should I do to setup a new MacBook pro for first time when moving from a PC?

    you have to use the migration assistant if you want your files transfered from your pc to mac this link will be helpful
    http://support.apple.com/kb/HT4796

  • Mass upload for info records when price gets changes

    Dear All,
    How to do Mass upload for info records when price gets change.
    Regards,
    Bhargav

    Hi Bhargav,
    Please upload the present price (Map) by  LSMW . When you are doing the transactions  then automatically by selecting option info update price will be updated the  info record in Order Price history
    Regards
    M B Raju

  • Computation only works for FIRST record in detail table

    Hi,
    I am having a weird problem. I have a master/detail form with page computations that work only for the very first record inserted into the detail table. If i try to enter a second or a third record the fields DO NOT get updated with the return values.
    This is driving me nuts and i am on a deadline with this project. HELP!!!!!
    Here is the code for all the computations below. Interestingly enough, only the name computation works for every new detail record. The others work only for the first.
    -- Calulate Social Security PL/SQL Function
    DECLARE
    p_is16to62ssrate NUMBER(6,2);
    p_u16o62ssrate NUMBER(6,2);
    p_dob DATE;
    p_base_date DATE := SYSDATE;
    p_age NUMBER(3);
    p_totalss NUMBER(9,2);
    BEGIN
    SELECT is16to62ssrate, u16o62ssrate
    INTO p_is16to62ssrate, p_u16o62ssrate
    FROM SSC3_RATES
    WHERE ratescheduleid = 1;
    SELECT dob
    INTO p_dob
    FROM SSC3_EMPLOYEES
    WHERE ssno = :P25_SSNO;
    p_age := TRUNC(MONTHS_BETWEEN(p_base_date,p_dob)/12);
    IF (p_age >= 16) OR (p_age <=62) THEN
    p_totalss := (:P25_TOTALWAGES * (p_is16to62ssrate/100));
    ELSIF (p_age < 16) OR (p_age > 62) THEN
    p_totalss := (:P25_TOTALWAGES * (p_u16o62ssrate/100));
    ELSE
    p_totalss := 0.00;
    END IF;
    RETURN p_totalss;
    END;
    -- Calculate Levy PL/SQL Function
    DECLARE
    -- declare local variables to hold rates from rates table
    p_hsdlarate NUMBER(6,2);
    p_hsdlbrate NUMBER(6,2);
    p_hsdlcrate NUMBER(6,2);
    p_hsdldrate NUMBER(6,2);
    p_hsdlaminearnings NUMBER(8,2);
    p_hsdlamaxearnings NUMBER(8,2);
    p_hsdlbminearnings NUMBER(8,2);
    p_hsdlbmaxearnings NUMBER(8,2);
    p_hsdlcminearnings NUMBER(8,2);
    p_hsdlcmaxearnings NUMBER(8,2);
    p_hsdldminearnings NUMBER(8,2);
    p_hsdldmaxearnings NUMBER(8,2);
    p_totalwages NUMBER(8,2);
    p_totallevy NUMBER(8,2);
    BEGIN
    -- Load rate info from table into variables
    SELECT hsdlarate, hsdlbrate, hsdlcrate, hsdldrate, hsdlaminearnings,
    hsdlamaxearnings, hsdlbminearnings, hsdlbmaxearnings,
    hsdlcminearnings, hsdlcmaxearnings, hsdldminearnings,
    hsdldmaxearnings
    INTO p_hsdlarate, p_hsdlbrate, p_hsdlcrate, p_hsdldrate,
    p_hsdlaminearnings, p_hsdlamaxearnings, p_hsdlbminearnings,
    p_hsdlbmaxearnings, p_hsdlcminearnings, p_hsdlcmaxearnings,
    p_hsdldminearnings, p_hsdldmaxearnings
    FROM SSC3_RATES
    WHERE ratescheduleid = 1;
    -- Assign total wages to variable
    p_totalwages := :P25_TOTALWAGES;
    -- Determine applicable levy payment and rate
    IF (p_totalwages < p_hsdlamaxearnings) THEN
    p_totallevy := (p_totalwages * (p_hsdlarate/100));
    ELSIF (p_totalwages >= p_hsdlbminearnings) AND (p_totalwages <= p_hsdlbmaxearnings) THEN
    p_totallevy := (p_totalwages * (p_hsdlbrate/100));
    ELSIF (p_totalwages >= p_hsdlcminearnings) AND (p_totalwages <= p_hsdlcmaxearnings) THEN
    p_totallevy := (p_totalwages * (p_hsdlcrate/100));
    ELSIF (p_totalwages >= p_hsdldminearnings) THEN
    p_totallevy := (p_totalwages * (p_hsdldrate/100));
    END IF;
    RETURN p_totallevy;
    END;
    -- Calculate Total Wages PL/SQL Function
    DECLARE
    t_wages NUMBER(8,2);
    BEGIN
    t_wages := (:P25_WEEK1_WAGE + :P25_WEEK2_WAGE + :P25_WEEK3_WAGE + :P25_WEEK4_WAGE + :P25_WEEK5_WAGE + :P25_BONUS + :P25_OTHER);
    RETURN t_wages;
    END;
    -- Calculate Employee Name PL/SQL Function
    DECLARE
    p_firstname VARCHAR2(20);
    p_lastname VARCHAR2(20);
    p_name VARCHAR2(40);
    p_join VARCHAR2(2) := ', ';
    BEGIN
    SELECT firstname, lastname
    INTO p_firstname, p_lastname
    FROM SSC3_EMPLOYEES
    WHERE ssno = :P25_SSNO;
    p_name := Initcap(p_lastname||p_join||p_firstname);
    RETURN p_name;
    END;
    Regards
    Glenroy Skelton

    Hi,
    The first thing that strikes me is the following IF test:
    IF (p_age >= 16) OR (p_age <=62) THEN
    p_totalss := (:P25_TOTALWAGES * (p_is16to62ssrate/100));
    ELSIF (p_age < 16) OR (p_age > 62) THEN
    p_totalss := (:P25_TOTALWAGES * (p_u16o62ssrate/100));
    ELSE
    p_totalss := 0.00;
    END IF;The first test will be true for every number as all numbers are greater than 16 or less than 62. I'd suggest changing the OR to an AND or use BETWEEN
    Andy

  • How to set Display Only for some records in CAT2 Worklist

    Hi,
    I have a requirement to modify an attributes for some records in the Worklist of CAT2.
    We have an external system where we book our time. Weekly we import data from that external system into CATSDB using BAPI for every single employee.
    We would like when the user wants to modify his time sheet to be able to add/modify all records except those which were imported from the external system. Which means that those records should be in Display only mode / grayed out / before release.
    Is there any user exit or BADI that could help to modify that attribute and that will be triggered before displaying the Worklist ?
    Please advise !
    Thanks,
    Stefan

    I've solved the problem.
    First I've added customer field in CI_CATSDB structure and when I am importing the data I am populating that field with 'X', which means that this is record from the external application.
    I've created enhancement implementation in Function group->CATS, screen->2003 MODULE->D2000_MODIFY_LOOP, subroutine->modify_d2000_loop where I am checking the field mentioned above if it is 'X' I am modifying the screnn-output = off.
    It works, thak you for your help.
    Regards,
    Stefan

  • Asp code does not render for first record in looped recordset

    I have posted this question on a javascript forum as it
    contains javascript code however it was believed to be an asp
    issue.
    The following head section javascript code contains the
    function showBigImage( isource,bigImage,header ) function call of
    discussion:
    var currentImage;
    function showBigImage( isource,bigImage,header ) {
    var theImage = document.getElementById( 'largeimage' );
    theImage.src = isource;
    currentImage = bigImage;
    document.getElementById( 'photoHeader' ).innerHTML=header;
    document.getElementById( 'largeimage' ).alt=header;
    The following rendered looped recordset code illustrates how
    the "header" parameter of this showBigImage(
    isource,bigImage,header ) function call does not render ONLY FOR
    THE FIRST RECORD OF THE RECORDSET as it is blank:
    <a href= "javascript:;" > <td height=36
    valign="middle" class="small_img" onmouseover="showBigImage(
    'imagescript.asp?path=images/portable_stage.jpg&width=250','images/portable_stage.jpg',''
    )"> <img
    src="imagescript.asp?path=images/portable_stage.jpg&width=36"
    border="0" alt="" /> </td> </a>
    <a href= "javascript:;" > <td height=36
    valign="middle" class="small_img" onmouseover="showBigImage(
    'imagescript.asp?path=images/seated_riserset.jpg&width=250','images/seated_riserset.jpg', 'Portable
    stage configuration using 9 units of the 3 ft x 8 ft platforms in 3
    different heights' )"> <img
    src="imagescript.asp?path=images/seated_riserset.jpg&width=36"
    border="0" alt="" /> </td> </a>
    <a href= "javascript:;" > <td height=36
    valign="middle" class="small_img" onmouseover="showBigImage(
    'imagescript.asp?path=images/Stageset.jpg&width=250','images/Stageset.jpg','Portable
    stage configuration using 16 units of the 4 ft x 8 ft platforms'
    )"> <img
    src="imagescript.asp?path=images/Stageset.jpg&width=36"
    border="0" alt="" /> </td> </a>
    <a href= "javascript:;" > <td height=36
    valign="middle" class="small_img" onmouseover="showBigImage(
    'imagescript.asp?path=images/Runset.jpg&width=250','images/Runset.jpg','Portable
    stage runset configuration' )"> <img
    src="imagescript.asp?path=images/Runset.jpg&width=36"
    border="0" alt="" /> </td> </a>
    Because of this problem, the caption text does not display
    for this first image record once the thumbnail images are moused
    over. You can view this page example at
    http://www.canchair.com/new_web_product_detail.asp?ProductID=198&ProductFamily=1&ProductFa milySub=10

    Please help with this issue!!!

  • Data Loader - Only imports first record; remaining records fail

    I'm trying to use Data Loader to import a group of opportunities. Everytime I run the Data Loader it only imports the first record. All the other records fail with the message "An unexpected error occurred during the import of the following row: 'External Unique Id: xxxxxxx'". After running the Data Loader, I can modify the Data file and remove the first record that was imported. By running the Data Loader again, the first row (previously the second row) will import successfully.
    Any idea what could be causing this behavior?

    W need a LOT more information, starting with the OS, and the version of ID, including any applied patches.
    Next we need to know if you are doing a single record per page or multiple records, whether the placeholders are on the master page, how many pages are in the document and if they all have fields on them (some screen captures might be useful -- embed them using the camera icon on the editing toolbar on the webpage rather than attaching, if it works [there seem to be some issues at the moment, though only for some people]).
    What else is on the page? Are you really telling it to merge all the records, or just one?
    You get the idea... Full description of what youhave, what you are doing, and what you get instead of what you expect.

  • Display only the first record

    I have report in BEx where we want to find the first time a customer ordered Quantity of more than 500 in a data range (For Ex: From April 10 to April 30). In a particluar date range the customer may order more than once (Qty > 500). The catch is we want display only one first time he ordered qty > 500.
    Customer    Date         Qty > 500.
    ABC         4/21/2005        2,035 CA
              4/22/2005        12,290 CA
              4/23/2005        4,826 CA
              4/26/2005        6,397 CA
              4/27/2005        1,538 CA
              4/28/2005        4,849 CA
    XYZ         4/25/2005        2,000 CA
              4/26/2005        12,000 CA
              4/27/2005        4,500 CA
              4/28/2005        6,300 CA
    In the output report we want to display the first record for each customer as:
    Customer    Date         Qty > 500.
    ABC         4/21/2005        2,035 CA
    XYZ         4/25/2005        2,000 CA
    Your help is really appreciated. Thanks.

    jayant,
    i think, you could use your date as a condition to filter by in your report... try looking that the properties of your KF and, under Calculations, set the 'Calculate Result as...' to the first value only.
    hope this helps - don't forget to give out points. =)
    ryan.
    ps. i've tried this, and it sort of works - just need a bit more of tweaking around. =)
    Message was edited by: Ryan Kristoffer Tan

  • Data merge only prints first record

    Help, please: I've done it over and over, checked my .cvs file, replaced prefs...
    BUT data merge will only print the first record either in create merged document or export to pdf.
    It WILL preview all records.

    W need a LOT more information, starting with the OS, and the version of ID, including any applied patches.
    Next we need to know if you are doing a single record per page or multiple records, whether the placeholders are on the master page, how many pages are in the document and if they all have fields on them (some screen captures might be useful -- embed them using the camera icon on the editing toolbar on the webpage rather than attaching, if it works [there seem to be some issues at the moment, though only for some people]).
    What else is on the page? Are you really telling it to merge all the records, or just one?
    You get the idea... Full description of what youhave, what you are doing, and what you get instead of what you expect.

  • Table cntrol field to be display/Change only For each record

    Hi all,
    How to set a particular Field in table control either as display only or
    change only for <b>each row</b> based on certain condition.I need to set this property for each record in table control not for the entire coloumn?.I know the procedure for setting up an entire coloumn in table control either as diplay or change only using <b>Loop at screen</b> statement.
    Conditions:
    If Material is batch managed:
    itab-batch field has to be <b>Display only</b> mode.
    if material is not batch managed:
    itab-batch field has to be <b>change mode</b>.
    <b>O/p of Table Control :</b>
    Material     Batch
    1000         Display only
    2000        Change only
    8000        Change only
    3500        Display only
    3600        Display only

    Hi Ravi,
              Thanks for your reply.I have put the code as u said. It is modifying the whole coloumn insted of  modifying Current row of the coloumn.
    I have tried to modify the screen property using  Table control attributes (TC-COLS).The following commented code is that logic.Even that also doing the same thing.Can yoy please tell me how to do it.
    MODULE tc_get_lines OUTPUT.
    LOOP AT SCREEN.
        IF screen-name = 'X_ZPINV-CHARG'.
          IF fg_batch = ' '.
            screen-input = 0.
          ELSE.
            screen-input = 1.
          ENDIF.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    LOOP AT tc-cols INTO tc_wa
      WHERE screen-name = 'X_ZPINV-CHARG'.
       IF x_zpinv-matnr IS NOT INITIAL.
         CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
           EXPORTING
             input  = x_zpinv-matnr
           IMPORTING
             output = v_matnr.
         SELECT SINGLE * FROM marc WHERE matnr = v_matnr
         AND werks = w_plant.
         IF marc-xchar IS INITIAL.
           tc_wa-screen-input = 0.
         ELSE.
           tc_wa-screen-input = 1.
         ENDIF.
         MODIFY tc-cols FROM tc_wa INDEX sy-tabix."    transporting screen-input
       ENDIF.
    ENDLOOP.
    ENDMODULE.                    "TC_GET_LINES OUTPUT

  • Unable to search for first record using the Preview tree

    Post Author: TheBig1980s
    CA Forum: General
    Hello:
    Users are unable to search for the first record in the Preview tab's tree.  The reason for this is because the first record is within the first page header of the report.  My guess is that, by design, Crystal takes the end user to whatever the first instance of the record iseven if that first record is in a page header.  That's not "good".  I want the user to be taken to the first record within the details of the reportnot within the page header.
    I have suppressed the page header to not print on the first record by using OnFirstRecord.  But, I still get the same issue where end users cannot select the first record in the tree without being taken to the page header.  Very strange.
    Can anybody think of any other ideas?
    Thanks!
    TheBig1980s

    Thank you Dave Merchant and try67 for your responses. As per my previous post, I contacted the company re the catalogue and they have responded favourably. I'll include their response because it gives the reason for the search failure as document compression which you might find interesting. I'll await their new catalogue and see if they have fixed the problem.
    Company response:
    Thank you very much for your input.  And yes, you are correct, the compression we used for the current catalogue's PDF format does strip out text included in the catalogue.  We used the compression settings we did with the intention of minimising download time, however I take your point about including text for search purposes (which I also utilise when I'm scanning through PDFs).
    We will actually be posting out our new catalogue next week and we'll release the new PDF version on the website at the same time.  I've asked our graphic designer to ensure that the PDF we use for the new catalogue includes searchable text.

  • How to populate only the first record by default when the page opens?

    Dear Members,
    I am using OAF R12 and my requirement is as follows:-
    When the user opens the custom OAF R12 page, I just want to query the first record from the underlying VO.
    For example, If the table has 10 rows, I just want to query the first row as soon as the page opens.
    I have written the below code:-
    Process Request Method of the CO:-_
    am.invokeMethod("initHeaders");
    Code in AM_
    public void initHeaders()
    HeadersVOImpl hVO = getHeadersVO1();
    hVO.initQueryHeaders();
    Code in VO_
    public void initQueryHeaders()
    executeQuery();
    As it is very clear that with the above code all the records will be queried. I have to add something before the executeQuery() method in the VO to just query the first record.
    Can any one please help me by guiding me what I should add before the executeQuery() method in the VO?
    Many thanks in advance.
    Regards,
    R4S.

    Hello Gyan,
    Many thanks for your reply.
    The below line in your code is throwing incompatible type error:
    OARow row = vo.first();
    Can you please help me.
    Regards,
    R4S

  • NI-5122 Multiple records: different trigger for first record

    Hi,
    I’m using a NI-5122 high-speed digitizer to acquire multiple records (say 100 of length 20 each), triggered by an external 1kHz source, and clocked by an external 80MHz clock.
    Is it possible to start the whole acquisition process (i.e. the first record) with a certain trigger signal (e.g. from PFI0), but trigger subsequent records with a different trigger signal (e.g. from TRIG)?
    Thanks in advance for your suggestions!

    TobiSL,
    Yes, what your asking for is possible, and the two trigger types you mentioned are called repectively: Start Trigger, and Reference Trigger.  You can configure each of these triggers separately.  To configure the Reference trigger you use the "niScope Configure Trigger vi".  To configure the start trigger, all you need to do is specify the source of the start trigger, using the niScope property node: "Start Trigger Source".  
    Hope this helps!
    Product Support Engineer
    National Instruments

  • JSP - useBean tag works only for first request

     

    hey why donnu change the scope to PAGE, give a try.........
              Vishal Vishnoi wrote:
              > Using Weblogic 5.1 I am trying to work with a simple example of a JSP
              > page which has got a usebean tag. The tag is
              >
              > <jsp:useBean id="resourceTypes" type="java.util.ArrayList"
              > scope="request" />
              >
              > * This works only the first time I load the page.
              >
              > If I try to load the page again. I get the following error
              >
              > javax.servlet.ServletException: Could not find bean 'resourceTypes',
              > type 'java.
              > util.ArrayList' in scope
              >
              > --Vishal
              

Maybe you are looking for

  • After Mountain Lion download, my Mac book pro does not recognize my login password. Help!, After Mountain Lion download, my Mac book pro does not recognize my login password. Help!

    I Have downloaded M Lion on a 2007 (?) 17" MacBook Pro and now the computer does not recognize my password on trying to restart.  Is there anyway to undo the download so I can get my computer back!!????

  • SCSM 2012 Forms (related items tab)

    Hi, We are using SCSM in our Production environment. I have a question about the "Select Object" function on Related Items Tab. When we  click on Add button on Related Items Tab under (lets say) "Configuration Items: Computer, Services and People" se

  • Corrupt P2 raw footage

    I am trying to transfer P2 MXF files through log and transfer, but the clip I need crashes FCP. I imported the file directly to both After Effects and Premier, but they crash as well. I'm assuming the data is corrupt. Are there any other utilities th

  • Separar datos puerto serial

    Buen día, Tengo un hardware que me envia datos por el puerto serial, pero no siempre envía la misma cantidad de datos. Lo que sí se manteninene constante es la estructura de los datos. Me envia dos valores delimitados por una coma (,). El primer valo

  • RFC basics?

    Hello All, I know the basic differences between tRFC and qRFC. I know how to create RFC's using SE37. But how do I create and use tRFC and qRFC? The RFC we usually create is a tRFC or qRFC? How do I recognize? Thanks in advance, Chandni