7 Replies Latest reply on Apr 16, 2013 8:16 PM by yomango

    Validation before saving record  based on two fields

    yomango

      Title

      Validation before saving record  based on two fields

      Post

           Hello out there. I have tried the following validation using all type of permutations but I can't get it to work all the time: 

           I have two fields: when in a field the word "approved" is typed in, the field Email needs to be populated. The record can't be saved if the condition is not met and a message should pop up: "You must enter email"

           Since the validation custom message works when the validation fails, and I am using a Calculation to validate data, it seems to me as if I have to write the calculation "the opposite" of what I want. If the calculation goes: Field1="approved" and Not IsEmpty(Email), any data that does not match the calculation will produce the Validation message". So, that calculation does not work.

           The calculation: Field1≠"approved" and Email=" ", will produce the message when I type  any other word in field1 and populate EMail. Does not work either. 

           And many other permutations I've tried. Can somebody help, please? I can make a trigger script to work when the "approved" word is typed in Field1, but that does not stop me from moving into another record if I do not comply.

            

           Thank you

        • 1. Re: Validation before saving record  based on two fields
          philmodjunk

               So which of the following would be valid data entry?

               Field1: Approved, Field2 not empty

               Field1: Value other than approved, Field2 not empty

               FIeld1 : value other than approved, Field2 empty

          • 2. Re: Validation before saving record  based on two fields
            yomango

                 Hello, Phil. Thank you for your time and interest. I want the Valid custom message to pop when I manually save the record and Field1: "Approved" and Field2: remains Empty, so Field2 has to be populated.

                 The valid data entry will be Field1:Approved, Field2:not empty, I think. But the Custom message pops up when the validation fails, meaning any other value on the fields will pop the message,but I do not want that, only when I save record and  Field1="approved" and field2= empty. It is kind of a backward validation; I have not been able to find the right calculation. Is there another way to validate the entry so I am not allowed to continue if I do not meet the validation?

            • 3. Re: Validation before saving record  based on two fields
              philmodjunk

                   Yes, but that's not what I am asking. I am trying to identify what data entry patterns are valid when field 1 does NOT have the value "Approved". Your validation has to return true for those value combinations as well as showing and error when Approved is entered into the field and and email is not entered into the email address.

              • 4. Re: Validation before saving record  based on two fields
                yomango

                     When field1 is not "Approved" nothing should happen. Same if field2 is populated or not  but field1 does not read "Approved". There are several values for field1 to choose from a value list , but I want the warning to pop when field1 is valued "Approved" and field2 is empty. Any other values on either field do not count for the warning to pop up. Does this make sense to you? Thanks

                • 5. Re: Validation before saving record  based on two fields
                  yomango

                       Hi, Phil. I got the validation to work after rereading your last post. It made me think "the other way", I had to validate ALL other options, except field1:Approved and field 2 Not Empty. The are only 8 values to pick from the drop down list. But what if there are many,many values? The calculated validation will be very long (the way I did it). I was looking for a compressed calculation. The way I have it now works and that's what counts.

                       Reps Status             =      "Pending"  and not IsEmpty(Email) or Reps Status             =      "Pending"  and IsEmpty(Email) or Reps Status             =      "Pending-states Registration"  and not IsEmpty(Email) or Reps Status             =       "Pending-states Registration"  and IsEmpty(Email) or  Reps Status             =      "Active"  and not IsEmpty(Email) or Reps Status             =       "Active"  and IsEmpty(Email) or Reps Status             =      "Termed"  and not IsEmpty(Email) or Reps Status             =       "Termed"  and IsEmpty(Email) or Reps Status             =      "Did Not Register"  and not IsEmpty(Email) or Reps Status             =       "Did not Register"  and IsEmpty(Email) or Reps Status             =      "Other"  and not IsEmpty(Email) or Reps Status             =       "Other"  and IsEmpty(Email) or Reps Status             =      "Pending-states"  and not IsEmpty(Email) or Reps Status             =       "NRF Termed"  and IsEmpty(Email)or Reps Status             =      "Approved"  and not IsEmpty(Email)

                       I am sure you have a shorter calculation to do the same as the above one, and if you do and/or have the time to post it, I will appreciate it. If not, no problem.

                        

                       Thanks again for your understanding and time. 

                  • 6. Re: Validation before saving record  based on two fields
                    philmodjunk

                         You should be able to simplify that as:

                         Field1  ≠ "Approved or ( FIeld1 = "Approved" and Not Isempty ( Field2 ) )

                    • 7. Re: Validation before saving record  based on two fields
                      yomango

                           Excelent. It works perfect. Thank you.