5 Replies Latest reply: Mar 20, 2013 12:30 PM by GregorM RSS

    Issue with when_validate_record or is it the correct one at all?

    951614
      I have a multi block child record. In that there are series of columns ....say column 1 to 6.
      I am validating these columns against certain values and if the validation fails , I am raising when form trigger failure
      I am doing this at the when validate record of the block level.

      DECLARE
      values := VARCHAR2 (1000) ;

      BEGIN
           values := :b1.c1||:b1.c2||:b1.c3||:b1.c4||:b1.c5||:b1.c6;
      ......after validation

      if
      validation_flag = 'N'
      then
      Fnd_message.set_string('Some message');
      fnd_message.show;
      raise form_trigger_failure;
      end if;

      Question
      -----------
      1) What should be the appropriate to handle this since this validation should happen if all the six segments are entered.
      There is no particular order in which the six segments are entered.
      Dont think when validate record s the correct one.

      2) As a work around, this message is being thrown after the user tries to save the record but he is able to navigate to the next record when he presses a down error. This shouldnt happen if the user wants to save the data.
      -----------------
      the above are the 2 options we are considering
      Please provide your poitners.

      Regards
      Siva
        • 1. Re: Issue with when_validate_record or is it the correct one at all?
          951614
          Correction
          ------------
          In question 1 - I meant columns
          In question 2 -the user presses a down arrow.
          -----------------
          • 2. Re: Issue with when_validate_record or is it the correct one at all?
            HamidHelal
            948611 wrote:
            I have a multi block child record. In that there are series of columns ....say column 1 to 6.
            I am validating these columns against certain values and if the validation fails , I am raising when form trigger failure
            I am doing this at the when validate record of the block level.

            DECLARE
            values := VARCHAR2 (1000) ;

            BEGIN
                 values := :b1.c1||:b1.c2||:b1.c3||:b1.c4||:b1.c5||:b1.c6;
            ......after validation

            if
            validation_flag = 'N'
            then
            Fnd_message.set_string('Some message');
            fnd_message.show;
            raise form_trigger_failure;
            end if;

            Question
            -----------
            1) What should be the appropriate to handle this since this validation should happen if all the six segments are entered.
            There is no particular order in which the six segments are entered.
            Dont think when validate record s the correct one.

            2) As a work around, this message is being thrown after the user tries to save the record but he is able to navigate to the next record when he presses a down error. This shouldnt happen if the user wants to save the data.
            -----------------
            the above are the 2 options we are considering
            Please provide your poitners.
            Hi, Siva
            You can validate combination of item via WHEN-VALIDATE-RECORD trigger. this will be the easy choice. I prefer it.
            but you can also validate at any item (should be the last one) via When-Validate-Item trigger. for this.. you need to create a program unit (procedure) and call in every item trigger. The last filled item will fire.

            When saving is not good one as because it's multi record tabular block.

            Hope this helps...


            Hamid

            Mark correct/helpful to help others to get right answer(s).*
            • 3. Re: Issue with when_validate_record or is it the correct one at all?
              GregorM
              Hi.

              For your requirement when-validate-record trigger is definitely the way to go.

              Best regards.
              • 4. Re: Issue with when_validate_record or is it the correct one at all?
                951614
                Hi gregor,

                But how to address the limitations (if you can call that) as I mentioned in my intiial psot

                Regards
                SR
                • 5. Re: Issue with when_validate_record or is it the correct one at all?
                  GregorM
                  Hi.

                  If I understood you correctly then you need to check those (in your example) 6 columns. If all of those column's values passes some test then you are good to go on the contrary you should raise an error. Is that right?

                  If so then on when-validate-record you should write something like that :

                  if :b1.col1 != same_check_value OR :b1.col2 != same_check_value OR ...
                  then
                  raise form_trigger_failure;
                  end if;

                  Also I am a little confused reading your second question. The raising of form_trigger_failure on when-validate-record should always stop user from navigating elsewhere. Or is it that you want to let the user navigate away form this record regardless this record is not validated (did not pass validation test) and you want just to stop the user when he/she is trying to save the input?

                  Best regards.

                  Edited by: gregor13 on Mar 20, 2013 6:22 PM

                  Edited by: gregor13 on Mar 20, 2013 6:28 PM