Tabular Form Validation: Comparing Two Columns vs Check Constraint

What is the best approach for validating that one column needs to be greater than another column in a tabular form when attempting to save. (E.g. An effective date and expirey date column. The expirey date column >= effective date column)
At the moment I have a check constraint on the two columns at the database level which is fine but it returns and passes up a pretty cryptic (from a business user perspective) unfriendly message to the user as follows:
Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-02290: check constraint (IDMTC.ADDRESS_TYPE_CON) violated, update "IDMTC"."ADDRESS_TYPE" set "ID" = :b1, "CODE" = :b2, "NAME" = :b3, "LOV_SORT_ORDER" = :b4, "DESCRIPTION" = :b5, "EFFECTIVE_DATE" = :b6, "EXPIRY_DATE" = :b7 where "ID" = :p_pk_col
Unable to process update.
Is there a way to inject, detect and/or replace this with a friendlier business user message? I have confirmed that the "Unable to process update." text at the bottom below the MRU Internal routine error raised from my check constraint is the process error message for my Apply MRU process.
I was hesitating going down a larger page level validation where I loop through the tabular form array and/or inject some client side Javascript.
Any advice? Have I simply overlooked some tabular form options for validating using cross column values?
Thanks,
Jeff

Jeff..Thanks for the response.
However because I am working in a tabular form at design time I don't know which controls I can reference in a dynamic action, or custom Javascript routine other than selecting all elements in a column using JQuery, etc.
I have decided to go with for the time being an approach I found here: doing validation on tabular form
My code ended up looking something like and was entered into a page level validation as a PL/SQL function body returning error text.:
DECLARE
l_error VARCHAR2 (4000);
BEGIN
FOR i IN 1 .. apex_application.g_f02.COUNT
LOOP
--If Expiry date is older then effective date
IF nvl(apex_application.g_f08 (i), to_date('31-DEC-9999', 'dd-mon-yyyy')) < apex_application.g_f07 (i) THEN
l_error :=
l_error
|| '</br>'
|| 'Row '
|| i
|| ': Expiry date must be greater than effective date '
|| ' for maintenance item name: '
|| apex_application.g_f03 (i);
END IF;
END LOOP;
RETURN LTRIM (l_error, '</br>');
END;
I had been hoping with Apex 4+ that there was additional native functionality to do this type of validation or somehow be able to reference a column or control name instead of a generic array column so that my code was better self documenting.
It works for now...but would love to revisit with maybe a cleaner client side solution that does the validation and highlights the invalid element since I still maintain data integrity at the db with the check constraint.
Thanks,
Jeff

Similar Messages

  • Using md5 in a manul tabular form to compare if column value changed

    Version: Application Express 3.2.0.00.27
    Hello,
    I am creating a manul tabular form using apx_item in my select statment that is the source for the query in a report region. I am using a collection. The collection creation statement is:
        apex_collection.create_collection_from_query(
           p_collection_name => 'DELEG_COLL',
           p_query           => 'SELECT authid
                               ,empid empid
                               ,to_char(deldate,''DD-MON-YYYY'') deldate
                               ,delscope delscope
                               ,dellimits dellimits
                               ,subdelrights subdelrights
                               ,to_char(delexpiry,''DD-MON-YYYY'') delexpiry
                               ,to_char(datedelremoved,''DD-MON-YYYY'') datedelremoved
                               ,delremovalcomments delremovalcomments
                               ,delegator delegator
                               ,''O'' original_record
                               ,wwv_flow_item.md5(delscope, dellimits, subdelrights,
                                  to_char(delexpiry,''DD-MON-YYYY'') delexpiry,
                                  to_char(datedelremoved,''DD-MON-YYYY'') datedelremoved,
                                  delremovalcomments, delegator)
                               FROM tbl_delegations
                               where empid = v(''P12_EMPID'')',
           p_generate_md5     => 'YES');The above code is giving me an error in the function
    wwv_flow_item.md5(delscope, dellimits, subdelrights,
                                  to_char(delexpiry,''DD-MON-YYYY'') delexpiry,
                                  to_char(datedelremoved,''DD-MON-YYYY'') datedelremoved,
                                  delremovalcomments, delegator)It doesn't seem to like where I attempt to convert date column delexpiry and datedelremoved to a varchar. I am doing this as in the db they are dates and inorder to using the md5 function to compare if the values have changed and only update rows where the values changed.
    There error that I get is:
    ORA-20104: create_collection_from_query Error:ORA-20104: create_collection_from_query ParseErr:ORA-00907: missing right parenthesis
    In the collection I am trying to store the md5 hash result. I haved all the update and insert logic working expect for date type columns. THose give the above error.
    I thank you ahead of time for your assistance!
    A. Shalon

    Helen,
    Not sure I fully understand your goal.  We don't use "tasks" at all but if you are looking to have your workflow check certain valus and be able to send email messages to people based on whatever, then you can certainly do that (as long as your Sharepoint
    has the email setup.  We do this for alot of workflow tasks.
    So, in the workflow you can have a blanket statement like what I previously listed:
    if Current Item:hiddenStatus  not equals Current Item:Status
        .... do something
    or you can do something like:
    if Current Item:hiddenStatus equals "In-Progress"
        .... do something
    Else if Current Item:hiddenStatus  equals "Completed"
        .... do something
    or combine the two and do nested "if" statements.  Then you add an email statement wherever you need it like:
    if Current Item:hiddenStatus  equals "Completed"
       then email "these users"
    To add the email part, just type in "email" on the line where you want to add a statment.  There is only one option to choose from.  That will display the line "then email these users".   The "these users" will be a link.  When you
    click it you will get a popup to add the email info.  We typically will send the email to a user (or users) that are already listed in one of the PeoplePicker fields.  On the email form, you can type in your own text, designate that a value is based
    on a column value (like our PeoplePicker), designate that a value is based on a workflow variable, add a link to the current item, etc.  To get to these options you will click the button to the right of the fields or use the "Add or Change Lookup" button
    in the bottom-left for the text area.  There is alot you can set in the mail.
    Does this help answer your question?
    - Peter

  • Detail tabular form based on two tables

    db11gxe , apex 4.0 , firefox 24 ,
    hi all ,
    i have a master detail form based on two tables , the detail form ofcourse based on one table , the problem is i want to include a column of another
    table into the tabular form , so i have changed the query of the tabular form and included the column in it correctly ,
    but the problem is about saving data , i can not save the data , i think
    because the "mru" process is based on one table , that is because i face an error talking about "mru" process when i try to save the data ,
    Error in mru internal routine: ORA-20001: no data found in tabular form Unable to process update.
    so
    what should i do to save the data ? should i create another "mru" process based on the other table or what ?
    thanks

    Anything beyond "simple" requires that you do it yourself.  I believe that what you want is "beyond simple"
    As far as I know, you can only use the 'mru' on one table.
    (I could be wrong)
    If the conditions are right, you might be able to simplify things such that you can use the 'mru'.
    ie CREATE VIEW on the two tables.
    However, you need to understand how Oracle treats DML operations on views, what type of views can be updated, etc., etc.
    If just creating the view doesn't work, creating an INSTEAD OF trigger on the view come to mind...
    (lol) - at that point, you have already started down the 'dark path' of creating your own 'MRU'
    personal note:  triggers have a really baaaddd habit of hiding code from other developers.  you are better off, in the long run, creating your own 'mru'..
    ie a package with procedures to handle INSERT, UPDATE, and DELETES
    MK

  • Tabular Form Validation not working in tabular form APEX 4.0

    Hi,
    I am using APEX 4.0. I have a tabular form with Tabular form validation done with it.
    Item not null is the validation.. so if I dont type any value in the any of the fields in the tabular form and press the Submit button, the first time error is shown... but when I click the Submit button again, with still the empty rows the page is submitted.
    How to resolve this issue?
    Edited by: Suzi on Oct 5, 2010 11:13 AM

    Look at this thread - Re: Validations of tabular forms in 4.0

  • Form split across two columns

    I am trying to layout a form split across two columns. Is
    this possible, tables or divs?
    Test
    Page Here
    My test form only submits the fields on the right:
    Phone:
    Email:
    How did you here about us?
    Rich

    Joey,
    Gonna sound dim here...what where?
    <div class="form1">
    <table width="640" height="239" border="0"
    cellpadding="0" cellspacing="0">
    <tr>
    <td width="320" valign="top"> Name:
    <input type="text" name="t1" size="36" />
    <br />
    Company:
    <input type="text" name="t4" size="36" />
    <br />
    Address:
    <p><span class="Roman9px">
    <textarea rows="4" name="st"
    cols="35"></textarea>
    </span> </p>
    Your message or enquiry details:
    <p><span class="Roman9px">
    <textarea rows="4" name="t5"
    cols="35"></textarea>
    </span></p>
    </td>
    <td width="320" valign="top"><form method="post"
    action="SubmitForm.asp">
    <p></p>
    Phone:
    <p>
    <input type="text" name="t2" size="36" />
    <br />
    Email: </p>
    <p class="bold">
    <input type="text" name="t3" size="36" />
    </p>
    <p>
    <label>How did you here about us?<br />
    <select name="t6" id="t6">
    <option value="None Selected"
    selected="selected">Please Select</option>
    <option value="Internet Search">Internet
    Search</option>
    <option value="Advertising">Advertising</option>
    <option
    value="Recommendation">Recommendation</option>
    </select>
    </label>
    </p>
    <p class="Roman9px"> </p>
    <p class="Roman9px">
    <input type="submit" class="Roman10px" value="Submit"
    />
    </p>
    </form>
    </td>
    </tr>
    </table>
    </div>
    Rich

  • Create ViewCriteria comparing two columns from same table

    Does anyone know how I can create a ViewCriteria where clause that compares two columns from the same table?
    For example if I had two integer columns (MINSAL and MAXSAL) and wanted to see if they are equal. I would normally do the following SQL below.
    SELECT * FROM EMPL
    WHERE MINSAL = MAXSAL

    It works, but it is not ideal.
    Setup a Transient column that performs a groovy evaluation of MINSAL=MAXSAL and then my ViewCriteria evaluates the column to true and I set Query Execution Mode to Both.

  • How to compare two programs to check variation in codes

    Hi,
         I would like compare two programs to check the variation in codes.
    Do we have any tool in SAP to do that.
    Cheers
    S Kumar

    Hi,
        I did award the points to you when I close the thread. I award it again..
    Cheers
    S Kumar

  • Tabular Form Validation - Save Correct Values

    I'm using Denes' example of tabular form validation. It finds the errors and displays the error messages, but I lose any values that were entered correctly. Do I need to use a collection to save them? I've been looking through older posts and one comment was that you'd only need a collection if you wanted to show the user the values they entered incorrectly. With Denes' logic it tells them what line had the error and what the original value was.
    DECLARE
      l_error   VARCHAR2 (4000);
    BEGIN
       FOR i IN 1 .. apex_application.g_f02.COUNT
       LOOP
          IF NOT TO_DATE (apex_application.g_f05 (i), 'YYYY')
                BETWEEN   TRUNC (TO_DATE (apex_application.g_f04 (i),'YYYY'))
                     AND  TO_DATE ('2008','YYYY')     THEN
                      l_error :=   l_error
                        || '</br>'
                        || 'Row '
                        || i
                        || ': Photo Inspection Year has to be greater than Date On Map and less than 2008 for '
                        || ' Map: '
                        || apex_application.g_f02 (i)
                        || '<br> Requested date: '
                        || apex_application.g_f05 (i);
          END IF;
          IF NOT TO_DATE (apex_application.g_f04 (i), 'YYYY')
                BETWEEN   TO_DATE ('1890','YYYY')
                     AND  TO_DATE ('2008','YYYY')     THEN
                      l_error :=   l_error
                        || '</br>'
                        || 'Row '
                        || i
                        || ': Date on map has to be between 1890 and 2008 for '
                        || ' Map: '
                        || apex_application.g_f02 (i)
                        || ' <br>Requested date: '
                        || apex_application.g_f04 (i);
          END IF;
       END LOOP;
       RETURN LTRIM (l_error, '</br>');Thanks,
    Susan

    It doesn't make sense to post your questions within a closed thread - start you own thread.
    It is possible to do that but you would need to save your data into a collection to keep the changes and display the error message on the same page.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How can I make a detailed form widget into TWO columns?

    how can I make a detailed form widget into TWO columns? I have a contact form with a lot of fields.

    Hi Whatsmyjam9999,
    You can place a blank composition widget then click tigger 1, click inside target 1 and from menu--> files--> place the image and adjust it's dimensions, you can repeat the same steps for trigger 2 and 3
    Here is a video link http://ghai2.worldsecuresystems.com/jing/2013-07-22_1442.swf

  • Form to compare two fields ... cast needed?

    Hi all gurus,
    I'm rebuilding a report that performs a lot of checks by comparing fields of two different structures.
    Basically, the check has a structure that is repeated over and over in many check: it looks like this:
    IF srm_items-{field1} NE r3_services-{field2}.            
       t_temp-prezzi_errati = icon_red_light.
       t_temp-error_code    = '{errorcode}'.
       IF counter_s = 0.
          PERFORM add_son_in_t_temp USING srm_items e_backend w_obj-posting_date w_obj-changed_at.
       ELSE.
          PERFORM add_additional_error_temp USING srm_items 0.
       ENDIF.
       counter_s = counter_s + 1.
       fl_errore_s = 'X'.
    I was thinking to create a form, say 'check_son', that takes as USING parameter , and . My doubt is about types ad casts; in a check, could be a text string, in another a number, in another again a guid, and so on. Always simple field (no structures or complex field by now), but for what that concerns my FORM:
    FORM check_son USING compare1
                                          compare2
                                          errorcode.
    how should I declare the form in order to have the check working? I mean, I'd like that compare1 and compare2 get the same TYPE of the parameter I pass.. Is there a way? Or implicitly the params are converted into text (this should not work for me)?
    Thanks in advance

    >
    Matteo Montalto wrote:
    > I don't know macros
    Hi, Matteo
    Test the following Sample Code it will help you to understand the working of Macros.
    DEFINE check_son.
      if &1 NE &2. " If Field1 Not Equal Field2
        &3 = 'NE'. " In This Variable it will Return Error Code NE for Not Equal and EQ for Equal
      else.
        &3 = 'EQ'.
      endif.
    END-OF-DEFINITION.
    DEFINE write_message.
      if &1 = 'EQ'.
        write: 'Two Numbers are Equal', /.
      else.
        write: 'Two Numbers are Not Equal', /.
      endif.
    END-OF-DEFINITION.
    DATA: f1 TYPE i,
          f2 TYPE i,
          error_code(2).
    f1 = 10. f2 = 15.
    check_son f1 f2 error_code.
    write_message error_code.
    f1 = 10. f2 = 10.
    check_son f1 f2 error_code.
    write_message error_code.
    Please Reply if any Confusion,
    Best Regards,
    Faisal

  • Tabular form validation to restrict user

    Dear all,
    I want to apply the validation on tabular form for my inventory module and I want to restrict the user  that the received quantity of particular item should not be greater than  the P.O quantity
    For example
    In  P.O
    Item Qty
    A 20
    Received Quantity
    Item Qty
    A 21
    Or if items are received in two shipments like as following
    Item Qty
    A 10
    A 11
    I want to put the validation to restrict the user that he can’t save the item quantity more then ordered quantity weather is received partialy or all at once, but I do not understand how can i do that.
    I m using Apex 4 with Oracle 11G R2 on windows Server 2003.
    Please help
    Thanks
    Suhaib
    Edited by: suhaib ahmed on Jun 18, 2011 1:39 PM
    Edited by: suhaib ahmed on Jun 19, 2011 12:53 PM

    hi,
    Refer Denes Kubicek - Apex Solution:
    http://apex.oracle.com/pls/otn/f?p=31517:41:7446375838232779:::RP,::
    http://apex.oracle.com/pls/otn/f?p=31517:214:7446375838232779:::RP,::
    Thanks,
    Kartik Patel
    http://patelkartik.blogspot.com

  • Compare two columns character by character

    Hi
    In a form I have block A. Which contains two columns Old Value and New Value both are of varchar datatype. I want to compare Old Value and New Value character by character and display the characters which are there in New Value but not in Old Value in a different colour when this block is being called.
    Example1 :Old Value : 13-Jul-2007
    And New Value : 19-Jul-2007
    I need the output to be display in this way - 19(in different clour)-Jul-2007. Only 9 should be in different colour.
    Example2 :Old Value : - (No value Previously)
    And New Value : SI DONE
    So output to be display in this way New Value "SI DONE" should be in different colour.
    Just to hightlight the users that this is change made instead of they manually compare field by field for the changes to take note..
    Pls help me this is bit urgent. Help me to suggest any java related coding can help me or any plugins that we can call thru forms to do it.. Pls help.
    Rishi

    You take a variable i (integer type) and initialize it to 1.
    Take a loop where u'll find one by one character in loop as follows.
    DECLARE
    i NUMBER(10) := 1;
    old_str VARCHAR2(240); -- For Old String
    new_str VARCHAR2(240); -- For New String
    differed_str VARCHAR2(240) := '';
    BEGIN
    WHILE i <= GREATEST(LENGTH(old_str),LENGTH(new_str))
    LOOP
    IF SUBSTR(old_str,i,1) <> SUBSTR(new_str,i,1) THEN
    differed_str := differed_str||SUBSTR(new_str,i,1);
    END IF;
    i := i + 1;
    END LOOP;
    END;
    So, now ur extra characters in New Field will be :differed_str.
    May be u can give a msg with that string.
    Thanx,
    Cheers,

  • How do I compare two columns of data in Numbers to find the unique results?

    Hello all,
    I'm looking for a way to compare the data from two columns so I can find the unique results and display that data in a third column. To be specific, here's what I'm doing.
    Column A is a list of email addresses for people I have already written. Column B is a list of email addresses for people I would like to contact. I am not sure if there are email address from Column A in Column B, but there may be and if there are, I must find out so that I don't send a second email to these recipients. How can I have Numbers look at both columns and tell me which email addresses in Column B are not in Column A?
    Thanks for the help!!!

    gfmp123,
    Here's an alternate use of MATCH to find duplicates. I hope you find one of the two solutions, Wayne's or this one, useful for your case.
    The expression in Column C is:
    =IFERROR("Dup in Row "&MATCH(B, A,0), "")
    Regards,
    Jerry

  • Compare two columns and match ALL recurring values, not just the first instance

    Hi everybody...
    I was looking for a way to compare values in two columns, identifying every duplicate value instance on a third column.
    Searching around the forums, I found a solution, albeit a partial one; I am using this formula: =IFERROR("Duplicate in row "&MATCH($A,$B,0),"") along column C, to compare values between columns A and B. When applied, the formula will render the first instance where there is a duplicate; unfortunately MATCH will only register the first instance of the duplicated values.
    For example:
    The first value on column A is 'Apple'. On column B there are three instances for the value 'Apple', the formula identifies the first of these values, but not the remaining two.
    I am not an advanced Numbers or Excel user, and the answer to this problem eludes me. I am attempting to compare columns that have no less than 1000 rows each, so you can imagine how, finding a solution to my problem would be really great.
    Thanks in advance,
    Pablo

    Unfortunately I can't see your screenshot, but supposing you have a table like this:
    Col1
    Col2
    1
    3
    Dupe
    2
    4
    Dupe
    3
    5
    Dupe
    4
    6
    5
    7
    Then here is one way to flag the duplicates.
    The formula in C2, copied down, is:
    =IF(COUNTIF($A,$B2)≥1,"Dupe","")
    Then filter on column C for 'Dupe', and copy the values in column B to wherever you need them.
    SG

  • Using Excel Functions, such as VLOOKUP to compare two columns of text for similarities

    My problem seems simple but I am struggling to figure it out. I have two columns of text. I am trying to see if the text in column B appears in column A. However, it is not always an exact match, and I basically want to check if column A contains the text
    that appears in column B. What is the best way to do this?

    In C2, use a formula like
    =IF(SUMPRODUCT(NOT(ISERROR(SEARCH(B2,$A$1:$A$1000)))*1)>0,"Found","Not Found")
    then copy down to match column B.
    This formula will return "Found" when the entire contents a cell in B is found somewhere in any cell in A1:A1000.  E.G.,  "red" in B2 is found in cell A100 which contains "I have a red dog"

Maybe you are looking for

  • Apps' content in Chinese despite correct region set

    Hi Guys! Let me start off by saying this is my first post and I've just set up an account with sole intention to seek advice. I really hardly ever register onto online boards where I have not contributed previously and start up threads that junk it u

  • Disk Utility reports "resource busy" and can't create an disk image

    HI, Just succesfully updated to Mountain Lion on my MBA and iMac. No problems. A very smooth proces. But, on my iMac the Disk Utility are not able to create new images at all! I'm not sure if this relates directly to the update, as DU works fine on t

  • HT2376 Trying to install scrapbook software but wont install due to quicktime

    I recently tried to install Software Scrapbook Boutique on my MAC Pro OS X Version 10.7.4 and all the files wont install without Quicktime. I have Quicktime Version 10.1, and it won't work.  I am administrater, I recently bought my laptop from a frie

  • Epson Home Theatoer Projector -- wireless connections?

    How would I wirelessly run a keynote or quick time presentation from my iMac. Will the moviemate 30 work? IMAC duo Mac OS X (10.4.6) plan to buy a moviemate 30s

  • Is it a bug for Oracle JDBC driver?

    Hi, I use the thin JDBC driver to connect my server, and try to obtain the meta data for the query data set. However, every time I issue 'getMetaData()' to get meta data, the following error is reported: java.lang.NumberFormatException: For input str