Validate duplicate data entry by user on form

On a form I have a block, in the block I have 3 fields. On block level on 'when-validate-record' I am trying to write a trigger. what I am trying to do is the following:-
If the user enters 'abcd' in the field... it's o.k
then he moves on to enter another record without saving the first record and enters 'abcd' again in the same field. (means the data is not saved in the table yet)
I want to pop up a message here and tell the user that he has entered the same data before in one of the records and he cannot do it again.
The trigger should be able to scan for all the records in the block and see if the data he is entering has been entered before on the form. I also have to check wether the data does not exist in the table as well.
that means I have to validate that 'abcd' should not be in the table and also 'abcd' should not be on the form as entered by the user.
Does anyone know what to do? this is what I am doing but it does not work?
v_orig_position := :system.trigger_record;
v_tax_id := :SITE_BLK.TAX_ID;
first_record;
loop
if v_tax_id = :SITE_BLK.TAX_ID and :SITE_BLK.TAX_AUTHORITY
= 'WSBC' THEN
v_taxid_count     := v_taxid_count + 1;
end if;
if (:system.last_record = 'TRUE') then
go_record(v_orig_position);
EXIT;
else
next_record;
end if;
end loop;
IF      v_taxid_count      > 1 THEN
FND_MESSAGE.SET_STRING(NVL(:site_blk.tax_id,'notaxid') ||' id already entered! ');
FND_MESSAGE.SHOW;
RAISE FORM_TRIGGER_FAILURE;
eND IF;
it gives me error message 'illegal restiction first_record' and the logic does not work..

Are you sure you're on the right forum? As far as I understood you are working with Oracle forms, and if you do not save the 1st row into Oracle DB ("means the data is not saved in the table yet"), then it's the buisiness of your client how to validate duplicates.
I also have to check wether the data does not exist in the table as well. UNIQUE constraint is the straightforward solution in 99.99% of the cases
As for your trigger logic try
Forms
Cheers

Similar Messages

  • Check duplicate data entry in multi record block,which is a mandatory field

    Dear all,
    I have a situation where i have to check duplicate data entry(on a particular field,which is a mandatory field,i.e. it cannot be skipped by user without entering value) while data key-in in a Multi Record block.
    As for reference I have used a logic,such as
    1>In a When-Validate-Record trigger of that block I am assigning the value of that current item in Table type variable(collection type)
    as this trigger fire every time as soon as i leave that record,so its assigning the value of that current time.And this process continues
    then
    2>In a When-Validate-Item trigger of that corresponding item(i.e. the trigger is at item level) has been written,where it compares the value of that current item and the value stored in Table type variable(collection type) of When-Validate-Record trigger.If the current item value is matched with any value stored in Table type variable I am showing a message of ('Duplicate Record') following by raise_form_trigger failure
    This code is working fine for checking duplicate value of that multi record field
    The problem is that,if user enter the value in that field,and then goes to next field,enter value to that field and then press 'Enter Query 'icon,the bolth Validate trigger fires.As result first when-validate record fires,which stores that value,and then when-validate-item fires,as a result it shows duplicate record message
    Please give me a meaningful logic or code for solving this problem
    Any other logic to solve this problem is also welcome

    @Ammad Ahmed
    first of all thanks .your logic worked,but still i have some little bit of problem,
    now the requirement is a master detail form where both master and detail is multirecord ,where detail cannot have duplicate record,
    such as..........
    MASTER:--
    A code
    A1
    A2
    DETAIL:--
    D code
    d1
    d2 <-valid as for master A1 , detail d1 ,d2 are not duplicate
    d2 <--invalid as as for master A1 , detail d2 ,d2 are duplicate
    validation rule:  A Code –D Code combination is unique. The system will stop users from entering duplicate D Code for a A Code. Appropriate error message will be displayed.*
    actually i am facing a typical problem,the same logic i have been applied in detail section ,its working fine when i am inserting new records.problem starts when i query,after query in ' a ' field say 2 records (i.e. which has been earlier saved) has been pasted,now if i insert a new record with the value exactly same with the already present value in the screen(i.e. value populated after query) its not showing duplicate.................could u tell me the reason?and help me out...............its urgent plzzzzzzzzz
    Edited by: sushovan on Nov 22, 2010 4:34 AM
    Edited by: sushovan on Nov 22, 2010 4:36 AM
    Edited by: sushovan on Nov 22, 2010 8:58 AM

  • Page level validation to prevent duplicate data entry into the database

    Hello,
    Can anyone please help me out with this issue.
    I have a form with two items based on a table. I already have an item level validation to check for null. Now I would like to create a page level validation to check that duplicate data are not entered into the database. I would like to check the database when the user clicks on ‘Create’ button to ensure they are not inserting duplicate record. If data already exist, then show the error message and redirect them to another page. I am using apex 3.2
    Thanks

    Hi,
    Have you tried writing a PLSQL function to check this?
    I haven't tested this specifically, but something like this should work:
    1) Create a Page Level Validation
    2) Choose PLSQL for the method
    3) Choose Function Returning Boolean for the Type
    For the validation code, you could do something like this:
    DECLARE
        v_cnt number;
    BEGIN
        select count(*)
        into v_cnt
        from
        your_table
        where
        col1 = :P1_field1 AND
        col2 = :P2_field2;
        if v_cnt > 0 then return false;
        else return true;
        end if;
    END;If the query returns false, then your error message will be displayed.
    Not sure how you would go about redirecting after this page though. Maybe just allow the user to try again with another value (in case they made a mistake) or just press a 'cancel' button to finish trying to create a new record.
    Amanda.

  • Problem When Try to add Master data record for User define form

    Hi,
    I have made one user define form. And assign UDO and fields proerly in form.
    But when I try to add the record from the form it will give me error
    Invalid Code [Operation Master  -Code] [Message 173-36]
    I have already bind the code field of the table to one field in the screen painter.
    Please give me the reply.
    Regards,
    Gunjan Shukla.

    Dear Shukla
    Can you please try to do the binding in the code (after loading the from).
    Doing that, do you still have the problem?
    Best regards,
    Miki

  • Data import for users of forms created with Livecycle Designer

    Hello,
    I have seen several posts regarding data import for forms created by Livecycle Designer but nothing that helps with something I am trying to accomplish.  I can create a data connection and import information in a form but what I would like to do is import data, then send the pdf for completion to a user.  There are a few data elements that I have available and the rest of the information comes from from the user.  The problem I run into is once I create a data connection, the pdf is ALWAYS looking for the source file for that data.  I simply want to prepopulate some fields and send to the various users for completion.  Any help would be greatly appreciated.
    Thanks!

    Which type of Data Connection are you trying to create?
    XML Schema, Sample Data File or WSDL?
    Creating any one of first two types(mentioned above) will only create schema and will never import any data into PDF.
    If you create the WSDL connection, you can surely import data (i.e. prepopulate data) into your PDF and forward it for users review/fill.
    If I misunderstood your question, please get me clarified.
    Nith

  • How can I validate a date field in Portal Forms

    I have a date field in portal forms that I want to perform validation on to make sure it's in the proper format before being accepted (mm/dd/yyyy). How can I validate against that field?

    Hi Ben,
    I took the time to test and revise. This is code that will validate a date entry (format MM/DD/YYYY). Just paste this in the "Before the start of the form..." window of the Additional PL/SQL code section of the form. Then add validateDate(); into the onBlur event window of the field in question. Replace the CYCLE_END_DATE with the field name in question.
    HTP.P('
    <SCRIPT LANGUAGE=javascript>
    function validateDate() {
    var ddObj;
    var mmObj;
    var yyObj;
    var day;
    var mon;
    var year;
    var field_val;
    var field_name;
    for (var j=0; j < document.forms[0].elements.length; j++) {
    field_name = document.forms[0].elements[j].name;
    field_val = document.forms[0].elements[j].value;
    if (field_name.substring(field_name.indexOf(''DEFAULT.'') + 8, field_name.lastIndexOf(''.01'')) == ''CYCLE_END_DATE'') {
    var delimPos = field_val.search(/\//i);
    if (delimPos < 0)
    alert(''Invalid date entry! Please enter in MM/DD/YYYY format. '' +
    ''e.g, Dec 21, 2003 would be entered as 12/21/2003'');
    else
    if (field_val.length != 10)
    alert(''Invalid date entry! Please Please enter in MM/DD/YYYY format. '' +
    ''e.g, Jan 1, 2003 would be entered as 01/01/2003'');
    else {
    month = field_val.substring(0, field_val.indexOf(''/''));
    day = field_val.substring(field_val.indexOf(''/'') + 1, field_val.lastIndexOf(''/''));
    year = field_val.substring(field_val.lastIndexOf(''/'') + 1, 10);
    /* Need to subtract 1 from value because in Javascript, January begins with 0
    and ends with 11 for December */
    month = month - 1;
    ddObj = new Date(year, month, day);
    mmObj = new Date(year, month, day);
    yyObj = new Date(year, month, day);
    if (ddObj.getDate(ddObj.setDate(day)) != day)
    alert(''Invalid day!'');
    if (mmObj.getMonth(mmObj.setMonth(month)) != month)
    alert(''Invalid month!'');
    if (mmObj.getYear(mmObj.setYear(year)) != year)
    alert(''Invalid year!'');
    </SCRIPT>
    ');

  • Check Duplicate data during data key-in Multi Record Block

    Dear all,
    I have a situation where i have to check duplicate data entry(on a particular field,which is a mandatory field,i.e. it cannot be skipped by user without entering value) while data key-in in a Multi Record block.
    As for reference I have used a logic,such as
    1>In a When-Validate-Record trigger of that block I am assigning the value of that current item in Table type variable(collection type)
    as this trigger fire every time as soon as i leave that record,so its assigning the value of that current time.And this process continues
    then
    2>In a When-Validate-Item trigger of that corresponding item(i.e. the trigger is at item level) has been written,where it compares the value of that current item and the value stored in Table type variable(collection type) of When-Validate-Record trigger.If the current item value is matched with any value stored in Table type variable I am showing a message of ('Duplicate Record') following by raise_form_trigger failure
    This code is working fine for checking duplicate value of that multi record field
    The problem here is that suppose if usee gets a message of ('Duplicate Record') and after that without saving the values if user try to query of that block then also when validate item fired where as I am expecting ORACLE default alert message('Do You want to save?'),I want to restrict this When-Validate Item fire during query time..........................while user try to query.
    Please give me a meaningful logic or code for solving this problem
    Any other logic to solve this problem is also welcome

    When-Validate-Record trigger
    When-Validate-Item triggerThat smells like Oracle Forms...
    And the Oracle Forms forum is over here: Forms

  • Prevent duplicate data

    I would like to make sure there are no duplicate data entries in my JSP that populates an Oracle database with a table called MainTable. MainTable has an Id field that is the primary key, ValData with a varchar data type, Fid and Fid2 are number data types. Fid and Fid2 are foreign key values that are taken from another table.
    Id   ValData   Fid   Fid2
    1    abc         34    2
    2    efg          23    34
    3    zeo         25    43Sometimes someone can enter duplicate data and the ValData, Fid and Fid2 will end up like this:
    Id   ValData   Fid   Fid2
    1    abc          34    2
    2    efg           23    34
    3    zeo          25    43
    4    zeo          25    43Is there anything in Java I can implement to prevent duplicate data entry in the above example?

    Thanks,
    It now works after I added unique constraints to each of the fields.
    Google results showed me that ORA-00001 is Oracle's Duplicate message and I added a condition in the SQLException Catch area and it catches all my Duplicate entry attempts and shows message to the user.
    Here is what I have and would like to know if this is an efficient way I am doing this??
    try
    // db stuff
    catch (SQLException sqle)
        String message = sqle.getMessage();  
        if (message.indexOf("ORA-00001") != -1)
            out.println("Duplicate Data entry.");  
        else
          out.println("some other ORA error");  
    }

  • Validate the Date Time

    Does any java library class support to validate the date of the user input?

    Error index is concerned with the pattern not with the value.
    SimpleDateFormat test = new SimpleDateFormat("yyyy-MM-dd");
    ParsePosition p = new ParsePosition(0);
    p.setErrorIndex(-1);
    Date d=test.parse("2002-1130",p);  //does not match the pattern
    System.out.println(p.getErrorIndex()); // index other than -1 expected
    p.setErrorIndex(-1);  //  initialize
    d=test.parse("2002-11-31",p);// match the pattern but value invalid
    System.out.println(p.getErrorIndex()); //-1 expected

  • Restricting data entry to a particular language in the form

    Hi,
    I created a multilingual form in which all the fields of the form are in a particular language . Now am trying to restrict data entry in the form to that language at the client side only . Say if it is a form in french, can we restrict the data entry to french only .  The approach i was trying to implement was adding a script against the change event of all data fields and see if the characters lie in the range of  the language unicode character set . But have not been successful in it yet . Can anybody help me find some way or provide any sample for it ?
    Thanks

    Hello, I'm German
    Probably you can restrict the characters used for text entry, so for example ü is allowed in the German form but not in French.
    But you will NEVER be able to restrict the users staying only writing French in French forms 100%.
    1) You sometimes, not often, do encounter letters that are not typical for the language. (Though it can appear in any kind of word, it's quite regular for names.)
    2) Let's say I fill the French form. I encounter a problem when I type in the word "Müller". This word wouldn't be French at all. The text will be delted and probably given an error message. Well... I learn out of this error message. Next time I'll type Mueller. ^^
    (I knew several pages were people were restricted to talk English by forbidding letters that were not used in English very often... That didn't stop us violating that rule. The only error that really bugged us wasn't the restriction in not using letters that don't exist in English but the "please don't swear or insult so." error that kept appearing for ex. when we used the German word for "that" (= "dass"). They just didn't like the last 3 letters.)
    3) Many countries have the same or include other countries unicodes. For example English could be written in the German form or in the French form.
    4) You can't get out the syslanguage as far as I know. This would be a great hint which language the person is using.
    5) I don't think you can use the spellcheck in any way... great violation against spellchecking could also be a hint for another language.
    I know a quite big internetcommunity which did try to accomplish the same as you do. After about 2 years and a lot of experiments they stopped their efforts and were content by popping up the random error-messages warning that you don't have to insult, just like those other communities mentioned above. ^^ (Though they tried to restrict the insulting parts to the language used that didn't work out. Too many people knew how to insult in other languages ;D or which words were similar to insults.)
    People just never do what they are supposed to do and are quite nasty finding workarounds...
    My advice to you would be:
    Don't make the effort.
    Sorry for not being able to provide you with a solution, but the opposite.
    Lisa

  • Possible to validate data entries during Digital Signature?

    I have a form that was built from scratch using Adobe LiveCycle  Designer ES 8.2. I also have Adobe Acrobat Pro 9.3.2. (WinXP)
    I  see numerous articles online related to validating user input prior to  data submission for an online form via a Submit button, however, I  am trying to figure out how to implement the same sort of data  validation during the signing of a particular digital signature field in an offline pdf form. Simply, I want to perform data validation during a digital  signature instead of when user presses Submit button.
    Here's my  use-case:
    1. Form Originator fills out a large number of data fields  and signs form via a CAC cert.
    2. Another person will review,  possibly edit/add data, and sign another signature block with CAC.
    3.  Then there is one more final CAC signature on the form before it is  completed and then emailed to the right folks for processing.
    4. I  would like to be able to enforce the population of several Mandatory  data fields (at least one Radio button and one text input, possibly  others) before the 3rd signature can be applied to the document.
    Again, I  need to emphasize this is all happening in an offline form, no data  submission or database back-end. Also, everything with the digital  signatures (and locking up fields afterword) works totally fine, just interested  in adding Data Validation capability during Digital Signature.
    I am in no way a javascript expert, but I can  probably learn from a good example. Any help or guidance is very much appreciated. Thanks...

    If you are using SignatureField in the form then you will get two events preSign and postSign which you can use to validate the field input just like you do with a Submit button.
    Thanks
    Srini

  • What can be considered as the business logic of simple data entry form

    Hi all,
    I want to separate my applications logic into layers. It is a simple data entry form and doesn't contain any complex business logic. So I want to get this simple business logic to different layer. But the problem is, I cannot clearly identify what are business logic of this kind of simple data entry form.
    How do I separate business logic of this simple data entry form to another layer?
    any help is appreciated,
    Thanks in advance,
    Dil.

    dcminter wrote:
    It is a [form] and doesn't contain any complex business logic. So I want to get this simple business logic to different layer. But the problem is, I cannot clearly identify what are business logic of this kind of [form].Are you asking which bits are business logic?
    Suppose that the data comes into your system immaculate from some external system. Imagine that it will go out into some other system. The bits that you would still have to write are your business logic.That's a nice practical definition. Thank you, I'm stealing it.
    Also interesting to note that validation falls into that category... say you're recieving data from a magical external source... you still have to validate it.
    And of course you'd still have to store it somewhere, ans retrieve it.
    Yep, I definately like that definition.
    Cheers. Keith.

  • HFM tables for WDEF (Web Data Entry Form)

    Hi all,
    is there a way for understanding which tables are used by the HFM for storing the member selections of the WDEF (Web Data Entry Form)?
    I was able to find only the table <application>_RPTS which contains the list of reports and folders I creted into the application.
    Now, I would like to retreive the tables where the info related to the member selections are stored.
    Can someone help me on this topic?
    Thanks in advance
    Christian

    Payous999 wrote:
    Dear All,
    I have created simple Web Data Entry Form in Planning 11.1.2 and not able to load the data through it (cells are read only)
    1. I have selected all the base level members for all the dimensions
    2. In Scenario version selection of Start Year End Year as well as Start Period and End Period is OK
    3. It is Bottom up version
    4. Is Evaluation Order any issue?
    5. Few days back while refreshing the database I receive the error 1060051 toi resolve that we need to delete the duplicate members from Oracle Table. We also deleted Essbase database and recreated the same
    Thanks
    PayousAre you logging in as admin, are they definitely all stored/never share level 0 members, is it a currency application.
    Evaluation Order should not be an issue.
    Point 5 is a little worrying, what did you do to resolve the issue? does it refresh without any issues now?
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Data entry form to submit to a web Service using webcenter

    Currently using Jdev 11.1.1.3, but have potential to upgrade to 11.1.1.4 or 5
    Most examples I see in the docs is using web services in webcenter is to display data but I need to pass data to a web service to process the data.
    Considering ways to show on a webcenter page a data entry form to send the entered data to a web service. Potential ways:
    1. Use Omniportlet that is based on a web service and define for each of the fields a parameter mapped to a displayed field. Submit the data to the web service to be processed.
    2. Use ADF syntax to create a web service proxy. Create a form with the needed fields, code a managed bean that uses the proxy code to submit the entered data in the form. Place the form on the webCenter page, but the webcenter already have a <af:form>, so a partialSubmit and autoSubmit set to "true" might be needed.
    Haven't used either and would greatly appreciate ideas and suggestions.
    Thanks

    With the omniportlet, you'll also have to test the form and so on :)
    My suggestion is indead an extra step but it is more flexible than just creation a DC from a WSDL. I already have done some implementation in Webcenter for web services and i started by just using the DC from a WSDL but soon i noticed that i needed more flexibility. That's why i suggest to create a proxy and create your own layer in front of it. This way you can easily control what you expose to your DC and do some initializations were needed. It offers a great deal of flexibility. That's why i suggest using the proxy + dc instead of wsdl + dc.
    When you should decide for migrating to Webcenter PS3, you can even expose datacontrols to your resource catalog. This way you can create your DC in JDeveloper and allow the business users to put the data controls on the page. a realy nice feature.

  • Make Item of Data Entry Form Insert Only, Non Updateable

    Hi,
    Can someone please tell me how to make an item on a data entry form insert only and not updateable. The user can enter the text item in insert mode but cannot update the text item in update mode. This was really simple in Oracle Forms, hoping it is as simple in APEX.
    Thanks

    I think that's too much of the wrong information.
    It sounds like you have multiple forms. Are they Modal or Non-Modal?
    What code do you use to call the form that's not working?
    Does it work initially and then stop working?
    James.

Maybe you are looking for

  • Which version of SCOM is this ?????

    Hi All, Question may sound silly, But i don't know a answer for it hence raised this question. I was reading this blog and found this type of a SCOM which i have never seen in the below link. http://www.opsmanager.se/2012/11/06/text-log-monitoring-pa

  • [SOLVED]Yajl 2.0 disabled yaourt

    after upgrading to yajl 2.0 today every yaourt operation about package results in: package-query: error while loading shared libraries: libyajl.so.1: cannot open shared object file: No such file or directory is there any temporary way to workaround i

  • Spot in photos taken with iPhone 3GS

    Recently, I've noticed a small spot on photos I've taken with my iPhone. Also I've noticed that the photos are slightly out of focus. On further investigation, I notice that I can see the spot through the phone before I take the photo, as I am focusi

  • PDF into Word

    Can an Arabic PDF document be converted into a Word document in the same language or should it be converted to one of the available languages only?

  • Database slow after Index compute statistics

    Dear All, Since 2 days back after executing Analyze Index compute objects to increase the response time some programs from my application have become very slow. After seeing this behaviour I went ahead and did a Analyze table compute statistic again