2 Replies Latest reply on Feb 14, 2016 4:50 AM by malachydevlin

    validation by calculation


      What should be simple is escaping me.. Getting old.

      I have a company name field (in a customers table) and i want to validate it that its not empty (But only when another field is of a certain value..).


      So I want the customer name to be mandatory when the customer type is set as "company"


      for some reason this doesn't work in "validation by calculation"


      If(customertype=company; length(company)>0;"")

        • 1. Re: validation by calculation

          The default result should be 1 (true):


               If ( customertype=company ; not IsEmpty ( company ) ; 1 )


          Otherwise, it'll default to False and the only time the validation will pass is if the other conditions are true.


          But this calculation still has a flaw. Are you validating customer name, or company? If it's the former, it should be:


               If ( customertype=company and not IsEmpty ( company ) ; not IsEmpty ( Self ) ; 1 )


          If not - you're trying to validate company the the calc is strange. customertype will be equal to company when it's empty, so you'll get caught in a loop (it'll never pass validation). (For the same reason, I added the not IsEmpty for company above.)


          Maybe that will get you on the right track.



          • 2. Re: validation by calculation

            super mike, yes that will sort my issue and thanks for the pointers.