10 Replies Latest reply on Jun 11, 2009 5:51 PM by mrvodka

    Nifty Function: ValueExists

    deltatango

      Title

      Nifty Function: ValueExists

      Post

      Use: Similar to PHP's in_array function. Return 1 if exact match found, otherwise 0.

       

      ValueExists(value, valuelist)

       

       

       Let(

      [

      count = ValueCount(valuelist);

      curVal = LeftValues(valuelist ; 1)

      ];

      If(

      count < 2;

      If(Exact ( valuelist ; value ); 1; 0);

       

      If(Exact ( curVal; value & "¶" ) ; 1 ; ValueExists(value; RightValues ( valuelist ; count - 1 )))

       

      )

      )