<?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>Replacing findfoldersbyname() with findcontentbyattribute() Content Tools Plugin</title><link>https://community.appian.com/discussions/f/plug-ins/25885/replacing-findfoldersbyname-with-findcontentbyattribute-content-tools-plugin</link><description>I am trying to replace findfoldersbyname() with findcontentbyattribute(), but can only get findcontentbyattribute() to return a List of Content, it returns something like [Content: 56629]. 
 
 Is there any way to return the folder itself instead of [Content</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Replacing findfoldersbyname() with findcontentbyattribute() Content Tools Plugin</title><link>https://community.appian.com/thread/101275?ContentTypeID=1</link><pubDate>Thu, 15 Sep 2022 14:24:59 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d1545d4a-d8e1-4388-b830-3ba39b137302</guid><dc:creator>paull4099</dc:creator><description>&lt;p&gt;That works! Thank you for the help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Replacing findfoldersbyname() with findcontentbyattribute() Content Tools Plugin</title><link>https://community.appian.com/thread/101274?ContentTypeID=1</link><pubDate>Thu, 15 Sep 2022 14:15:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:01bdede5-9894-4267-a65f-668397211e5c</guid><dc:creator>Mike Schmitt</dc:creator><description>[quote userid="163928" url="~/discussions/f/plug-ins/25885/replacing-findfoldersbyname-with-findcontentbyattribute-content-tools-plugin/101272#101272"]I was wondering why index() does not work on the list of content? [/quote]
&lt;p&gt;Index() is for returning the position in an array.&amp;nbsp; It can also do what property() does and return a dot property.&amp;nbsp; But the result given by the contentByAttribute() plug-in is, as far as I know, basically just an integer - meaning the data doesn&amp;#39;t actually have a property called &amp;quot;Content&amp;quot;, it&amp;#39;s literally just an integer wrapped in a data type (&amp;quot;Content&amp;quot;) where the default output is a string that says &amp;quot;[Content:56629]&amp;quot;.&amp;nbsp; But this is not a dictionary/CDT, it&amp;#39;s just integer data.&lt;/p&gt;
&lt;p&gt;In any case, when you wrap such output in tointeger(), anything inside the string that&amp;#39;s an integer gets pulled out and returned by the function.&lt;/p&gt;
&lt;p&gt;I do notice &amp;quot;tofolder()&amp;quot; doesn&amp;#39;t play nicely with the direct output of the function.&amp;nbsp; But when you wrap the output in tointeger() first it seems ok.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!directOutput: findcontentbyattribute(
    searchAllContent: false(),
    contentType: &amp;quot;folder&amp;quot;,
    attributeName: &amp;quot;name&amp;quot;,
    searchCriteria: &amp;quot;Additional Documents&amp;quot;,
    rootFolder: 12345
  ),
  
  /* tofolder() and tointeger() both play nice with array inputs, so no real need to do a!forEach() here */
  tofolder(tointeger(local!directOutput))
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Replacing findfoldersbyname() with findcontentbyattribute() Content Tools Plugin</title><link>https://community.appian.com/thread/101272?ContentTypeID=1</link><pubDate>Thu, 15 Sep 2022 13:41:44 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f2686c18-ecd1-434d-87fa-d65b07c3e6fa</guid><dc:creator>paull4099</dc:creator><description>&lt;p&gt;Hi Mike,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When I do toFolder() with its input being what is returned from&amp;nbsp;findcontentbyattribute() i.e. a list of Content ([Content:56629]), nothing is returned.&lt;/p&gt;
&lt;p&gt;Then I tried to index() the list of Content to try and retrieve&amp;nbsp;56629. Index([Content:56629], &amp;quot;Content&amp;quot;), and I received&amp;nbsp;an error:&amp;nbsp;Invalid index: Cannot index property &amp;#39;Content&amp;#39; of type Text into type List of Content.&lt;/p&gt;
&lt;p&gt;Then I used a foreach() to index the list of content i.e. foreach([Content:56629], fv!item). This successfully singled out&amp;nbsp;56629 as an integer. Then, doing tofolder() retrieved a the correct folder object.&lt;/p&gt;
&lt;p&gt;I was wondering why index() does not work on the list of content? Or is there any other (more efficient way than foreach) to retrieve the&amp;nbsp;56629 from the list of Content?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Replacing findfoldersbyname() with findcontentbyattribute() Content Tools Plugin</title><link>https://community.appian.com/thread/101204?ContentTypeID=1</link><pubDate>Wed, 14 Sep 2022 21:47:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:207342b5-5c6c-4e7c-9e2a-dda7e0e01b0f</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;At the end of the day, a folder is just an ID, regardless of what data type it&amp;#39;s been wrapped in.&amp;nbsp; What happens when you wrap the output in &lt;em&gt;&lt;strong&gt;toFolder()&lt;/strong&gt;&lt;/em&gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>