سؤال

I have a custom SharePoint 2010 List that I am attempting to perform list verification on. I have searched Google, Microsoft, and Stack however I can't seem to wrap my head around how to perform the following verification to get it to resolve as TRUE or FALSE for all situations.

This is a multi-column list, but for this validation I only care about Column B and Column D.

Column B is a Choice with the following items:
Item A 
Item B
Item C
Item D 
Item E
Item F
Item G

Column D is a Choice with the following items:
Item A
Item B
Item C
Item D
Item E 

Here is what I am trying to achieve:

There are three items in Column B. Whenever a user selects one of these items (Item C, Item D, Item E) then Column D can not be Item A or Item E. In other words the user must select from Column D any other item except Item A or Item E. If the user does not select Item C, Item D, or Item E from Column B, then Column D will always be Item A because Column D is hidden unless the user selects one of the three items in Column B. Note: Column D is hidden in a custom NewItem form using JavaScript.

Things I have tried: IF(), OR(), AND() using a combination thereof including nesting IF() statements. Note: I am aware of PreSaveAction() however I would rather use List Validation.

Example:

IF(
   OR( [Column B]="Item C", [Column B]="Item D", [Column B]="Item E" )
   ,IF(
       OR( NOT([Column D]="Item A"), NOT([Column D]="Item E") )
      , TRUE
      , FALSE
      )
   , FALSE
  )

In this example, If Column B is not Item C, Item D, or Item E the validation is FALSE and the user gets the message.

How can I perform this validation?

هل كانت مفيدة؟

المحلول

I found the answer to my question as follows:

IF(
   OR( [Column B]="Item C", [Column B]="Item D", [Column B]="Item E" )
   ,IF(
       OR([Column D]="Item A", [Column D]="Item E"))
      , FALSE
      , TRUE
      )
   , TRUE
  )

I was pretty close! lol

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى sharepoint.stackexchange
scroll top