This discussion is archived
2 Replies Latest reply: Mar 29, 2013 5:35 AM by VANJ RSS

Multiple not null validations

VANJ Journeyer
Currently Being Moderated
APEX 4.2.1

There is an old Validation Configuration about creating multiple not null validations. As stated, the Create multiple not  null validations page in the Builder has been taken out in 4.x. The Item setting Required is nice but it doesn't really allow us to conditonally execute the validations (e.g. when button X is pressed and page item value Y = Z). To do that, we need the regular item level validation which has the standard Condition attribute. The nice thing about the out-of-the-box not-null validation, associated with a page item, is that it higlights the item in question and provides a Go To Error link in the validation message.

Setting this up for one item is fine but I am not looking forward to copying this for the 2 dozen page items that I need.

I suppose I could write some function-returning-boolean validation using the APEX dictionary views but that would be ONE validation and you lose the features of the built-in validation mentioned above.

Any ideas? How can these validations be setup in bulk?
  • 1. Re: Multiple not null validations
    Nicolette Expert
    Currently Being Moderated
    VANJ

    Have a look at [url http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_error.htm#BGBEEGIB]apex_error.add_error.
    Add_error registers a error as if it was a normal validation.
    Giving you the option of logging multiple validation errors using one validation.

    Nicolette
  • 2. Re: Multiple not null validations
    VANJ Journeyer
    Currently Being Moderated
    Nicolette - That looks like exactly what I am looking for, thanks! Need to read up on all the new APIs introduced in 4.2. As always, the APEX team has done a fantastic job of crafting well-designed, easy to use APIs.

    The add_error Signature 2 should do what I need. Seems to work fine, just put the code in a after-submit before-validation process and the end result is identical to the out-of-the-box not-null validation.

    [Slight inconvenience is that the out-of-the-box validation's error message lets us use the #LABEL# substitution string. But in a custom process using apex_error, I guess one could pluck the label from the APEX_APPLICATION_PAGE_ITEM dictionary view and use that in the apex_error.add_error.p_message parameter]

    Thanks for your help.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points