<?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>Expression evaluation error at function &amp;#39;contains&amp;#39; [line 39]: Invalid types, can only act on data of the same type (Any Type, Text)</title><link>https://community.appian.com/discussions/f/rules/9090/expression-evaluation-error-at-function-contains-line-39-invalid-types-can-only-act-on-data-of-the-same-type-any-type-text</link><description>Hello All, I need to read an array extracted by a datasubset just to know if it contains a particular string Following the code contains( index( local!datasubset.data, &amp;quot;status&amp;quot;, null ) ,&amp;quot;TO DO&amp;quot;) I have this eror Expression evaluation error at function</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Expression evaluation error at function 'contains' [line 39]: Invalid types, can only act on data of the same type (Any Type, Text)</title><link>https://community.appian.com/thread/52463?ContentTypeID=1</link><pubDate>Fri, 09 Feb 2018 12:56:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9b15af18-5f55-4d39-8742-5efde182a1b6</guid><dc:creator>sergeiz</dc:creator><description>Thanks, it&amp;#39;s not easy to find this function.&lt;br /&gt;
&lt;br /&gt;
I can use any() but it is ten times slower than contains().&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression evaluation error at function 'contains' [line 39]: Invalid types, can only act on data of the same type (Any Type, Text)</title><link>https://community.appian.com/thread/43817?ContentTypeID=1</link><pubDate>Mon, 06 Mar 2017 23:58:41 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7d354757-b334-47b4-9f9f-7292d66eb263</guid><dc:creator>eliav</dc:creator><description>yes, thank you !&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression evaluation error at function 'contains' [line 39]: Invalid types, can only act on data of the same type (Any Type, Text)</title><link>https://community.appian.com/thread/40559?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2016 21:25:16 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d0d8f342-6d85-4929-86b6-6fe0d6536091</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Here&amp;#39;s a quick snippet that anyone can test out in the expression editor to see the difference between &amp;#39;touniformstring()&amp;#39; and &amp;#39;tostring()&amp;#39; ;-)&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;contains(
  touniformstring(
    {
      &amp;quot;qwer&amp;quot;, &amp;quot;asdf&amp;quot;, &amp;quot;zxcv&amp;quot;
    }
  ),
  &amp;quot;asdf&amp;quot;
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression evaluation error at function 'contains' [line 39]: Invalid types, can only act on data of the same type (Any Type, Text)</title><link>https://community.appian.com/thread/40558?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2016 21:25:12 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:41a0f9fe-7b0f-4d46-be0c-1c55a4b6336e</guid><dc:creator>eliav</dc:creator><description>touniformstrig() works !!  :O&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression evaluation error at function 'contains' [line 39]: Invalid types, can only act on data of the same type (Any Type, Text)</title><link>https://community.appian.com/thread/40557?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2016 21:24:46 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ac3dae75-b932-4ecd-a694-59735e034e2a</guid><dc:creator>PhilB</dc:creator><description>Also if you&amp;#39;re going to use index there (an option is to remove it altogether), then you should probably set the default for index() to be touniformstring({}) or similar, as null will be of the wrong type!&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression evaluation error at function 'contains' [line 39]: Invalid types, can only act on data of the same type (Any Type, Text)</title><link>https://community.appian.com/thread/40556?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2016 21:23:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:df944eb7-e806-4404-8819-7ea82ce027e5</guid><dc:creator>Stefan Helzle</dc:creator><description>contains(&lt;br /&gt;touniformstring( &amp;lt;--------&lt;br /&gt;index(&lt;br /&gt;local!datasubset.data,&lt;br /&gt;&amp;quot;status&amp;quot;,&lt;br /&gt;null&lt;br /&gt;)&lt;br /&gt;),&lt;br /&gt;&amp;quot;TO DO&amp;quot;&lt;br /&gt;),&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression evaluation error at function 'contains' [line 39]: Invalid types, can only act on data of the same type (Any Type, Text)</title><link>https://community.appian.com/thread/40555?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2016 21:23:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5ccc52c0-bc42-4d4d-b298-9323e626ecda</guid><dc:creator>Mike Schmitt</dc:creator><description>A valid code snippet should be something like:&lt;br /&gt;&lt;br /&gt;contains(&lt;br /&gt;  touniformstring(&lt;br /&gt;    property(&lt;br /&gt;      local!datasubset.data,&lt;br /&gt;      &amp;quot;status&amp;quot;,&lt;br /&gt;      {} /*null*/&lt;br /&gt;    )&lt;br /&gt;  ),&lt;br /&gt;  &amp;quot;TO DO&amp;quot;&lt;br /&gt;)&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression evaluation error at function 'contains' [line 39]: Invalid types, can only act on data of the same type (Any Type, Text)</title><link>https://community.appian.com/thread/40554?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2016 21:23:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8b91f648-d6ae-4959-83ee-a91857186faa</guid><dc:creator>PhilB</dc:creator><description>Apologies - the guys are right, I should have said touniformstring() :)&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression evaluation error at function 'contains' [line 39]: Invalid types, can only act on data of the same type (Any Type, Text)</title><link>https://community.appian.com/thread/40553?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2016 21:22:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f409e6d0-368e-4f24-9ed9-9d6d0bf91ed1</guid><dc:creator>eliav</dc:creator><description>Ok, but I have a strange behaviour&lt;br /&gt;&lt;br /&gt;contains(&lt;br /&gt;    tostring(&lt;br /&gt;      index(&lt;br /&gt;        local!datasubset.data,&lt;br /&gt;        &amp;quot;status&amp;quot;,&lt;br /&gt;        null&lt;br /&gt;      )&lt;br /&gt;    ),&lt;br /&gt;    &amp;quot;TO DO&amp;quot;&lt;br /&gt;  ),&lt;br /&gt;&lt;br /&gt;Doesn&amp;#39;t work , TO DO value is not found (returned value is false)&lt;br /&gt;&lt;br /&gt;If I try &lt;br /&gt;&lt;br /&gt;contains(&lt;br /&gt; {&amp;quot;TO DO&amp;quot;; &amp;quot;DONE&amp;quot;; &amp;quot;DONE&amp;quot;; &amp;quot;DONE&amp;quot;} ,  &amp;quot;TO DO&amp;quot;) &lt;br /&gt;&lt;br /&gt;it works and the returned value is true &lt;br /&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression evaluation error at function 'contains' [line 39]: Invalid types, can only act on data of the same type (Any Type, Text)</title><link>https://community.appian.com/thread/40552?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2016 21:21:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:7fd79deb-4101-4f42-adf9-04cdcab27982</guid><dc:creator>Stefan Helzle</dc:creator><description>You can use the function touniformstring() to convert a list of any data to a list of strings. tostring() concatenates all items to a single string.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression evaluation error at function 'contains' [line 39]: Invalid types, can only act on data of the same type (Any Type, Text)</title><link>https://community.appian.com/thread/40551?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2016 21:20:48 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6a394f48-aa52-4e81-bd61-6ba26b6839ac</guid><dc:creator>Mike Schmitt</dc:creator><description>Be careful - contains() expects its first parameter to be an array, and in this case it&amp;#39;s an array of the property &amp;quot;status&amp;quot; from your datasubset.  Wrapping this in &amp;quot;tostring()&amp;quot; will cause the whole array to be converted into one concatenated string, in which case your contains() call will return FALSE in cases where it should return TRUE.&lt;br /&gt;&lt;br /&gt;I think the proper rule to use in this case would be &amp;#39;touniformstring()&amp;#39;, which converts an array into an array of strings.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression evaluation error at function 'contains' [line 39]: Invalid types, can only act on data of the same type (Any Type, Text)</title><link>https://community.appian.com/thread/40550?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2016 21:18:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2643ef37-fc1f-40b4-8be2-6631302eae0d</guid><dc:creator>Ram</dc:creator><description>Hi Elia,&lt;br /&gt;&lt;br /&gt;Try the below code snippet replacing the data in index function and contains search value.&lt;br /&gt;I hope this will help you.&lt;br /&gt;contains(&lt;br /&gt;  split(index({&lt;br /&gt;    {&lt;br /&gt;      name: &amp;quot;aaa&amp;quot;,&lt;br /&gt;      age: 21&lt;br /&gt;    },&lt;br /&gt;    {&lt;br /&gt;      name: &amp;quot;bbb&amp;quot;,&lt;br /&gt;      age: 22&lt;br /&gt;    }&lt;br /&gt;  }, &amp;quot;name&amp;quot;, null), &amp;quot;;&amp;quot;),&lt;br /&gt;  &amp;quot;aaa&amp;quot;&lt;br /&gt;)&lt;br /&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression evaluation error at function 'contains' [line 39]: Invalid types, can only act on data of the same type (Any Type, Text)</title><link>https://community.appian.com/thread/40549?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2016 21:13:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:0d7b56a4-b1fd-4c44-924c-8db8518bd3b5</guid><dc:creator>Rama Thummala</dc:creator><description>@eliav&lt;br /&gt;Here index() returns AnyType value. For contains() you are passing AnyType value and Text value, so it is giving error. convert the output of index() to Text either by using tostring() or cast(&amp;#39;type!{namespace}Text&amp;#39; ,index() output )&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression evaluation error at function 'contains' [line 39]: Invalid types, can only act on data of the same type (Any Type, Text)</title><link>https://community.appian.com/thread/40548?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2016 21:06:54 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dc0e58bb-2ab9-4fef-a5f5-01bad15d8c48</guid><dc:creator>rodgraham</dc:creator><description>You can use the cast function on the status to convert it to text to allow the use of contains&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Expression evaluation error at function 'contains' [line 39]: Invalid types, can only act on data of the same type (Any Type, Text)</title><link>https://community.appian.com/thread/40547?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2016 21:06:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9dc5300b-27cf-4732-8d30-a6f1f76329c6</guid><dc:creator>PhilB</dc:creator><description>Try wrapping the index() function in tostring().&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>