AnsweredAssumed Answered

Nifty Function: ValueExists

Question asked by deltatango on Jun 11, 2009
Latest reply on Jun 11, 2009 by mrvodka

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 )))

 

)

)

 

Outcomes