<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>check an array has  mix of values</title><link>https://community.appian.com/discussions/f/general/20065/check-an-array-has-mix-of-values</link><description>I have a condition where if a list contains only numbers as 10, i.e{10,10,10,10} I should return 1 else If list contains any numbers apart from 10 i.e{23,50,60} I have to return 0 else if that list contains mix of 10 and other numbers {10,23,45} then</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: check an array has  mix of values</title><link>https://community.appian.com/thread/78432?ContentTypeID=1</link><pubDate>Fri, 11 Dec 2020 07:34:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9e7f0eb7-387c-4ec6-a5d1-797f18f664f6</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;You can compare a list of values to a single value and it will return a list of booleans for each.&lt;/p&gt;
&lt;p&gt;and({10,10,10,10} = 10) =&amp;gt; true&lt;/p&gt;
&lt;p&gt;and({10,10,10,11} = 10) =&amp;gt; false&lt;/p&gt;
&lt;p&gt;or({10,10,10,11} = 10) =&amp;gt; true&lt;/p&gt;
&lt;p&gt;or(&lt;span&gt;{23,50,60}&lt;/span&gt; = 10) =&amp;gt; false&lt;/p&gt;
&lt;p&gt;Using an and() would check for all values equal 10. Using an or() would check for at least one value equals 10. That should get your three cases covered.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: check an array has  mix of values</title><link>https://community.appian.com/thread/78429?ContentTypeID=1</link><pubDate>Fri, 11 Dec 2020 07:03:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f819f9c5-34b9-40dc-bbf5-6c223bdc87cb</guid><dc:creator>Dude</dc:creator><description>&lt;p&gt;Sidharth, please test the code with different lists like&amp;nbsp;&lt;span&gt;&lt;span style="color:#0000ff;"&gt;local!array1,local!array2,local!mixedArray&lt;/span&gt;.wherecontains(10, &lt;span style="color:#0000ff;"&gt;local!array1&lt;/span&gt;),&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Replace the list name in the&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;a!localVariables(&lt;br /&gt; /* Values for testing*/&lt;br /&gt; local!array1: { 10, 10, 10 },&lt;br /&gt; local!array2: { 23, 50, 60 },&lt;br /&gt; local!mixedArray: { 10, 23, 45 },&lt;br /&gt; /*Checking results */&lt;br /&gt; local!howManyOccurrances: wherecontains(10, &lt;span style="color:#0000ff;"&gt;local!array1&lt;/span&gt;),&lt;br /&gt; local!isArrayHasAll10s: length(local!array1) = length(local!howManyOccurrances),&lt;br /&gt; if(&lt;br /&gt; /*If list contains same number, return 1*/&lt;br /&gt; local!isArrayHasAll10s,&lt;br /&gt; 1,&lt;br /&gt; /*If list contains different numbers along with given number , return 2*/&lt;br /&gt; if(&lt;br /&gt; local!howManyOccurrances &amp;gt; 0,&lt;br /&gt; 2,&lt;br /&gt; /*If list contains different numbers than the given number , return 0*/&lt;br /&gt; 0&lt;br /&gt; )&lt;br /&gt; )&lt;br /&gt;)&lt;/p&gt;
&lt;p&gt;Note: When you use the logic in the implementation take care of the null checks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>