none
Using sharepoint 2010 validate a boolean field based on its own true/false value and len of another field from same list

    Question

  • Using sharepoint 2010 I created a list with 2 fields: [Active] YES/NO (Boolean) and [Frequency #] string len 7.

      

    I am trying to add a validation into the Active Field, to control that when Active = "Yes" (true), the [Frequency #] is not empty, and when Active = "No" (false), the [Frequency #] is empty.

      

    To begin, I make this validation rule, which is not being accepted by SP.

      

    =IF(AND([Active]=TRUE,LEN[Frequency #] > 0),TRUE, IF(AND([Active]=FALSE,LEN[Frequency #] = 0), TRUE, FALSE))

     

    I'm not sure what is wrong here. I believe, I am not using the right syntax for validation rules.

     

    Anyway, I have tried other versions with no sucess.

     

    Any suggestions?

    Edgar

     

    Monday, January 09, 2012 4:55 PM

Answers

  • hello edgar,

    Go the List Settings page and open List Validation Settings page. Enter the below formula in this page.

    =OR(AND([Active]=FALSE,[Frequency]=""),AND([Active]=TRUE,NOT([Frequency]="")))

    Check the column names before applying...

     


    Ram Prasad Meenavalli | MCTS SharePoint 2010 | MCPD SharePoint 2010
    • Marked as answer by edgarmora4033 Monday, January 09, 2012 6:07 PM
    Monday, January 09, 2012 5:19 PM
  • While waiting for suggestions I tried by myself and worked out this way:

    Remove validation from field itself.

    Add this working validation to the list:  

    =IF(AND(Active=TRUE,LEN([Frequency #])>0),TRUE,IF(AND(Active=FALSE,LEN([Frequency #])=0),TRUE,FALSE))

     

    • Marked as answer by edgarmora4033 Monday, January 09, 2012 6:10 PM
    Monday, January 09, 2012 6:10 PM

All replies

  • hello edgar,

    Go the List Settings page and open List Validation Settings page. Enter the below formula in this page.

    =OR(AND([Active]=FALSE,[Frequency]=""),AND([Active]=TRUE,NOT([Frequency]="")))

    Check the column names before applying...

     


    Ram Prasad Meenavalli | MCTS SharePoint 2010 | MCPD SharePoint 2010
    • Marked as answer by edgarmora4033 Monday, January 09, 2012 6:07 PM
    Monday, January 09, 2012 5:19 PM
  • While waiting for suggestions I tried by myself and worked out this way:

    Remove validation from field itself.

    Add this working validation to the list:  

    =IF(AND(Active=TRUE,LEN([Frequency #])>0),TRUE,IF(AND(Active=FALSE,LEN([Frequency #])=0),TRUE,FALSE))

     

    • Marked as answer by edgarmora4033 Monday, January 09, 2012 6:10 PM
    Monday, January 09, 2012 6:10 PM
  • Both solutions work.

    Edgar

    Monday, January 09, 2012 6:11 PM
  • its woking

    Thanks

    Friday, July 06, 2012 7:07 AM