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.

Similar Messages

  • Prevent past date entry on the delivery date field

    Hi Guys,
    I was wondering whether it is possible within standard SAP Business one 8.8 to prevent users from entering past date in the delivery date field on the Sales order screen.   I have people making mistakes by entering 10/10/2010 instead of 10/10/2011.  This caused problems with reports etc..
    Is there a formatted search query i can create to warn/alert users with a message stating incorrect date entered? Please advice best course of action?
    Regards
    nick

    Deepak,
    The following code is already in this section?  Can i just add Gordon query below the last "END" statement?
    --    ADD   YOUR  CODE  HERE
    declare @islocked int
    select @islocked = 0
    if(@object_type = '17' and @transaction_type <> 'A')
    select @islocked = U_LockedForEdit from [@A1WMS_Staging] where U_objType = '17' and U_docEntry = @list_of_cols_val_tab_del
    if(@object_type = '22' and @transaction_type <> 'A')
    select @islocked = U_LockedForEdit from [@A1WMS_Staging] where U_objType = '22' and U_docEntry = @list_of_cols_val_tab_del
    if(@object_type = '202' and @transaction_type <> 'A')
    select @islocked = U_LockedForEdit from [@A1WMS_Staging] where U_objType = '202' and U_docEntry = @list_of_cols_val_tab_del
    if(@islocked <> 0)
    begin
    select @error = 999
    select @error_message = 'Order Cannot be Updated/Canceled/Deleted as it is Locked in WMS'
    end

  • 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");  
    }

  • Should be able to enter both Japanese data and English data into the database without

    Scenario 1:
    Database Char Set: UTF 8
    National CharSet :UTF8
    String Type:Varchar2
    Problem :Unable to enter more than 1/3rd of the field length specified when entering Kanji(Japanese) Data
    Scenario 2:
    Database Char Set: JA16EUC/JA16SJIS
    National CharSet :JA16EUCFixed/JA16SJISFixed
    String Type:NVarchar2
    Problem :Unable to enter/retrieve English data written into the database but works fine with Japanese
    Scenario 3:
    Database Char Set: UTF8
    National CharSet :JA16EUCFixed
    String Type:NVarchar2
    Problem :Unable to enter/retrieve English data written into the database but works fine with Japanese
    null

    You will not be able to display the process form, or edit those values from the view profile screen.
    You would need to create custom fields that are mapped from the process form to the user's profile. Then you would need to create user form update triggers from the User Defined Fields that when the user changes them, they get pushed to the target process form by adding those task names into the provisioning process definition. This would then trigger the updates to the target resource.
    -Kevin

  • 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

  • Item Level & Page Level Validation..

    Hi ,
    What is the difference between Item Level validation & Page Level validation..
    in which sceneario it will be useful.
    Anoo..
    Edited by: Anoo on Dec 16, 2008 5:04 AM

    Hi,
    From the APEX help:
    * Item level validations are specific to a single item.
    * Page level validations do not apply to any single item, but apply to an entire page.
    {code}
    Paulo Vale
    [http://apex-notes.blogspot.com]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How to implement a page level validation !!

    Hello ,
    I want to implement page level validation.
    thanks
    Edited by: kumar73 on Apr 21, 2010 1:41 PM

    Should be pretty easy - your condition would probably just be the click of the button (button name) or the request value sent by the button (SUBMIT?) You can do a function returning boolean as the type
    The code would be something like:
    begin
      if :P1_SHUTTLE is not null or
      :P1_SHUTTLE2 is not null or
      :P1_SHUTTLE3 is not null or
      :P1_SHUTTLE4 is not null or
      :P1_SHUTTLE5 is not null then
        return(true);
      else
        return(false);
      end if;
    end;

  • Recommended practice for handling page level validation?

    I'm wondering what the recommended practice is for handling what I would call "page level validation?"
    For example, I have two text boxes. Either one text box or the other must have a non-null value. If they are both null, I want the page validation to fail and redisplay the page the same way it would if validation for a particular field failed. However, I don't want the message that is posted to be associated with either of the two text boxes. I want it to use some other unique ID because I want to display the error text at a location that is different than for either of the text box error messages.

    The reason I don't want to use a custom converter is because I'm using a custom tag/renderer which aggregates several HTML input components and has complex conversion logic. Maybe I could chain things together, but, a converter should be used for conversion not validation. Secondly, I don't understand why validation occurs after conversion. This seems backward to me.
    One hack that I tried which almost worked was to create a custom tag/rendererer that was an input component, but, had no visible UI. I made that component always have a value which caused the validator to always be called. I made it so that it accepted a method binding as an input so that you could specify which validation method was called. I checked the component values for the components of interest using UIInput.getValue(). However, I ran into what might be a bug. Everything worked fine as long as the value changed to a non-null value. When the value was set to null, UIInput.getValue() was returning the old value instead of null. The strange thing is that the bean property that the component was bound to, ultimately was changed to null as I would have expected to. The problem was that UIInput.getValue() was returning the old value instead of null.
    My current solution which isn't ideal is by using code similar to the following in my action method that my form submit button calls.
    if(value1 == null && value2 == null) {
    String message = "Validation Error: Value is required.";
    FacesContext context = FacesContext.getCurrentInstance();
    context.addMessage("id1", new FacesMessage(message, message));
    return "validationError";
    Note, I had to create my own custom tag/renderer equivalent of h:message because I couldn't get h:message to work. h:message couldn't find the message that I posted.
    The down side to doing it this way is that the validation is occurring after the validation phase. Hence, the error message isn't displayed at the same time as other error messages. Furthermore, if you have more than one button on the form, you'd have to do the check for each action method.
    This is really stupid. I can't believe something that should be so simple is so difficult in JSF. I'm planning on taking a closer look at ASP.NET. I'm pretty sure all you have to do in ASP.NET is override a method to do this and you have access to all the form controls as variables within the Page object. i.e. no having to lookup the controls using a method and a client ID.

  • Duplicate material entry at the time of PO creation based order type

    How Restrict duplicate material entry at the time of PO creation based on define order type.
    Moderator message: please do some research before asking.
    Edited by: Thomas Zloch on Mar 11, 2011 1:45 PM

    Hi Rahul,
    try with This Badi  ME_PROCESS_PO , Method Open or Process item,
    Implemente it and use a break-point to test it i.e it is triggred or nt , before processing it.
    Regards,
    Abhisek

  • How to make data entries in a database table field as a hyperlink?

    Hello all,
    I am designing an application in BSP. The requirement is to  make some of the entries in the database
    tables as hyperlink values.
    I have a database table which has a field "country feature". The scenario is  that the user can enter any value in this field through view. The value can be a hyperlink or a free text, depending on the user requirement.
    Is there any way by which the user can enter hyperlink values in the particular field in a database table?
    Thanks in advance for your help.
    Gurmahima.

    Hey Gurmahima ,
    This is sample code for Selecting and deselecting all the checkboxes .
    All you have to do is Set a pf-status and follow the code logic .
    Here w_check is the check box field , w_line is the line your raeding and w_lines is the total number of lines(entries ) you have in table .
    set pf-status 'SELECT' .
    case sy-ucomm .
        when 'SELECTALL' .
          set pf-status 'SELECT' excluding 'SELECTALL' immediately.
          w_line = w_line + 3  .
          do w_lines times .
            read line w_line field value w_check .
            if w_check = space .
              w_check = 'X' .
              modify line w_line field value w_check.   
              add 1 to w_line .
            endif .                        " IF W_CHECK = ' '
          enddo .                          " DO W_LINES TIMES
          clear w_line .
        when 'DESELECT' .
          set pf-status 'SELECT' excluding 'DESELECT' immediately.
          w_line = w_line + 3  .
          do w_lines times .
            read line w_line field value w_check .
            if w_check = 'X' .
              w_check = space .
              modify line w_line field value w_check .
              add 1 to w_line .
            endif .                        " IF W_CHECK = 'X' .
          enddo .                          " DO W_LINES TIMES
          clear w_line .
    Hope you get it!
    Much Regards ,
    Amuktha .
    Edited by: Amuktha Naraparaju on Feb 5, 2009 6:22 AM

  • Clearing of GR/IR Account for initial stock entry into the system

    Hi All,
    We  MM team did some initial stock entry into the system using MVT TYPE 561 in migo transaction. But in the FI, When GR/IR clearing account was checked, these entry's caused by the initial stock entry are not cleared. when tried to clear It gives a message saying this cannot be manually cleared.Do any of you know what should be done in this case?

    I have one more Questiion, in my company there is some amount that is not balancing. We feel that is due to the initial stock entry of the Materials is there a way to view what was the value stock on a particular date by particular movement type, we have transaction in MM but that does not give the currency, in the currency column it says $0.00.

  • Importing XML Data Back into the Form

    I have a form that shows several subforms based on the selections the user has made while filling in the form. This is working quite well but when I import the XML data back into the form it doesn't show the subforms that have been used.
    Is there an easy way to change this?
    Thanks in advance!
    Emma

    Actually the issue may actually have to do with the fact that the connections aren't bound, but I haven't seen the data.
    I have some fairly complex forms that include both subforms and instances, have an XSD embedded and export as XML. When I import the data, everythi
    Now, that being said...
    Are your subforms "hidden" and you opt to display them upon selection of a radio button for example, or do you SetInstances()? If you're using visible=TRUE or FALSE, that may also cause some issues.
    Try this -- on Form:ready try this code:
    if(this.rawValue == "on"){ //this radio button 1
    _subform1.setInstances(1);
    _subform2.setInstances(0);
    _subform3.setInstances(0);
    else if(this.rawValue == "on"){ //this radio button 1
    _subform1.setInstances(0);
    _subform2.setInstances(1);
    _subform3.setInstances(0);
    else if(this.rawValue == "on"){ //this radio button 1
    _subform1.setInstances(0);
    _subform2.setInstances(0);
    _subform3.setInstances(1);
    else { // this is fisrt time open -- i sometimes had issues with subforms being visible on first entry
    _subform1.setInstances(0);
    _subform2.setInstances(0);
    _subform3.setInstances(0);
    Then on:Click essentially copy most of the code you put in form:ready
    if(this.rawValue == "on"){ //this radio button 1
    _subform1.setInstances(1);
    _subform2.setInstances(0);
    _subform3.setInstances(0);
    else if(this.rawValue == "on"){ //this radio button 1
    _subform1.setInstances(0);
    _subform2.setInstances(1);
    _subform3.setInstances(0);
    else if(this.rawValue == "on"){ //this radio button 1
    _subform1.setInstances(0);
    _subform2.setInstances(0);
    _subform3.setInstances(1);
    Of course this will go on top of your radio button group.
    If you are exporting to XML, it will make your life a whole lot easier, by the way, to import an XSD and bind your nodes, especially as your forms and data start to get more complex.
    Finally, you may also know this but -- unless you have Forms Server, any user that wants to export the data or import the data will need to have at least full Acrobat Professional. If you want people to be able to save data in the form but import/export isn't that important, they will need to have full Acrobat.
    I hope that helps a bit. Good luck!
    Lisa

  • Error while reading file entries from the database

    Hi there,
    We are running a instance of xmii 12 in a VM (VMware) and after somebody shutdown the host machine without shutting down the VM (great idea isn't it?) we keep getting this message when trying to access xMII:
    "Application cannot be started.
      Details:   com.sap.engine.services.deploy.container.ExceptionInfo: Error while reading file entries from the database."
    Any clue? Any suggestion on how we can recover from that?
    Thanks a whole lot,
    Dom
    Server log:
    #1.5 #000C29A3B1F20002000000C400000F2800044829A35270F8#1205243578005#/System/Server##com.sap.engine.services.dbpool.deploy.ContainerImpl####n/a##60152160ef7211dcb7a5000c29a3b1f2#SAPEngine_System_Thread[impl:5]_17##0#0#Info#1#com.sap.engine.services.dbpool.deploy.ContainerImpl#Plain###DataSources or DataSource aliases of 'sap.com/tcmonitoringsysteminfo' application started successfully.#
    #1.5 #000C29A3B1F20002000000C500000F2800044829A3527A6C#1205243578005#/System/Server##com.sap.engine.services.servlets_jsp.server.container.WebContainer####n/a##60152160ef7211dcb7a5000c29a3b1f2#SAPEngine_System_Thread[impl:5]_17##0#0#Info#1#com.sap.engine.services.servlets_jsp.server.container.WebContainer#Plain###application [] Start of application [sap.com/tcmonitoringsysteminfo] finished successfully on Web Container.#
    #1.5 #000C29A3B1F20002000000C600000F2800044829A3527DB5#1205243578005#/System/Server##com.sap.engine.services.deploy####n/a##60152160ef7211dcb7a5000c29a3b1f2#SAPEngine_System_Thread[impl:5]_17##0#0#Info#1#com.sap.engine.services.deploy#Plain###
    Operation startApp over application sap.com/tcmonitoringsysteminfo finished successfully on server 305221750#
    #1.5 #000C29A3B1F20002000000C700000F2800044829A3527E03#1205243578005#/System/Server##com.sap.engine.services.deploy####n/a##60152160ef7211dcb7a5000c29a3b1f2#SAPEngine_System_Thread[impl:5]_17##0#0#Info#1#com.sap.engine.services.deploy#Plain###
    Operation startApp on application sap.com/tcmonitoringsysteminfo finished on current cluster node for 221 ms.#
    #1.5 #000C29A3B1F20002000000C800000F2800044829A3528B49#1205243578005#/System/Server##com.sap.engine.services.deploy####n/a##60152160ef7211dcb7a5000c29a3b1f2#SAPEngine_System_Thread[impl:5]_17##0#0#Error#1#com.sap.engine.services.deploy#Plain###Error occurred while initially starting application sap.com/xappsxmiiear:Error while reading file entries from the database.#
    #1.5 #000C29A3B1F20002000000CA00000F2800044829A352922B#1205243578015#/System/Server##com.sap.engine.services.deploy####n/a##60152160ef7211dcb7a5000c29a3b1f2#SAPEngine_System_Thread[impl:5]_17##0#0#Info#1#com.sap.engine.services.deploy#Plain###The synchronization of applications with DB completed for 39304 ms.#
    #1.5 #000C29A3B1F200040000000200000F2800044829B290A4F8#1205243834341#/System/Server/SLDService##com.sap.sldserv.DataCollector####n/a##0da42150ef7311dcb908000c29a3b1f2#SAPEngine_System_Thread[impl:5]_7##0#0#Warning#1#com.sap.sldserv.DataCollector#Plain###Communication configuration is incomplete. No data transfer possible until corrected.#

    Well thanks for the hint. Actually, the DB was up but corrupted. I managed to solve the bug by re-deploying xMII (using the SDM tool) which kept all my data but redeployed both the config db of (x)mii and the class files.

  • Uploading spreadsheet data into the database

    Hi
    I want to upload the spreadsheet data into the database through front end...I dont have any idea how to do upload without using the 'utilities' option..Can anyone please help me to do this?
    Thanks in advance
    Fazila

    Hi
    I refered the example sent by vikas...but i could not understand..I dont need to specify table name in runtime...my requirement is that I will have the constant table(say MD look up table)...and I will have some data under the column heading( say repid,split name)...
    Now I want to import my spreadsheet data which are under the heading repid and split name through my front end application and I have the option whether to 'overwrite' the records or 'append' the new records...after clicking the necessary option..I want to import my spread sheet data into the table defined already...and my another requirement is that I want to check the duplication of data between the spreadsheet and table...If I find the duplicates, I have to omit it and store the remaing details....
    Please give me some guidelines to solve this problem....
    Thanks in advance
    Fazila

  • How to select alternate entries from the database table

    Hi Experts,
    can u help me, how to select alternate entries from the database table.
    Thanks

    As there is no concept of sequence (unless there is a field specifically included for the purpose), there is no meaning to "alternate" records.
    What table do you have in mind, what data does it hold, and why do you want alternate records?
    matt

Maybe you are looking for