<?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>cut out the name of a document</title><link>https://community.appian.com/discussions/f/rules/28882/cut-out-the-name-of-a-document</link><description>Hey all. 
 I have a validation in which the name of the uploaded attachment can&amp;#39;t have more than 100 characters. I need that Appian automatically cut the name to maximum 100 characters. 
 I was trying to make an expression rule; I made an index to find</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: cut out the name of a document</title><link>https://community.appian.com/thread/113901?ContentTypeID=1</link><pubDate>Wed, 07 Jun 2023 16:16:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6b6b8414-43bb-449a-9817-6bfd7be61c97</guid><dc:creator>erikae9994</dc:creator><description>&lt;p&gt;Really useful... Thank you so much!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cut out the name of a document</title><link>https://community.appian.com/thread/113824?ContentTypeID=1</link><pubDate>Tue, 06 Jun 2023 20:14:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:12daae1d-eba2-4573-a36d-346f97cb4908</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I think you need to understand what &lt;em&gt;index()&lt;/em&gt; does -- when you give it a number as the second parameter, it attempts to return a corresponding &lt;em&gt;&lt;strong&gt;array position&lt;/strong&gt;&lt;/em&gt; from the source data.&amp;nbsp; Since a text string is really just an &lt;em&gt;array of characters&lt;/em&gt;, it will return you the letter at that position of the string.&amp;nbsp; Note this isn&amp;#39;t really a conventional use of index() (and not every function will treat a string as an array of characters), but that&amp;#39;s what it&amp;#39;s doing here, and from what I can tell it&amp;#39;s totally unrelated to what you&amp;#39;re really after.&lt;br /&gt;&lt;img alt=" " src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/15/pastedimage1686082464303v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;I believe you might have some success using the &amp;quot;fileNames&amp;quot; parameter of FileUploadField and your expression rule.&amp;nbsp; Personally, I&amp;#39;d opt instead to just use a user-facing validation similar to the following:&lt;br /&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!file: null(),

  a!fileUploadField(
    saveInto: local!file,
    value: local!file,
    maxSelections: 1,
    validations: {
      if(
        len(fv!files.name) &amp;gt; 5,
        &amp;quot;filename too long (5 characters for this example)&amp;quot;,
        null()
      )
    }
  )
)&lt;/pre&gt;&lt;br /&gt;...which will simply provide some feedback like this:&lt;br /&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/15/pastedimage1686082837251v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;However I assume (but haven&amp;#39;t tried per se) that you could instead use the &amp;quot;fileNames&amp;quot; parameter as I mentioned to auto-truncate the filename - note that, as far as I can tell, the change doesn&amp;#39;t happen until Form Submission time, so you&amp;#39;ll need to experiment with it some.&lt;br /&gt;&lt;pre class="ui-code" data-mode="java"&gt;a!localVariables(
  local!file: null(),

  a!fileUploadField(
    saveInto: local!file,
    value: local!file,
    maxSelections: 1,
    
    fileNames: left(fv!file.name, 5)  /* insert your own length here */
    
    /*validations: {
      if(
        len(fv!files.name) &amp;gt; 5,
        &amp;quot;filename too long (5 characters for this example)&amp;quot;,
        null()
      )
    }*/
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cut out the name of a document</title><link>https://community.appian.com/thread/113818?ContentTypeID=1</link><pubDate>Tue, 06 Jun 2023 17:28:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:25894b0c-e9e9-4486-a212-d731a9757f46</guid><dc:creator>markansink</dc:creator><description>&lt;p&gt;You can use left(ri!text,100) to get the first 100 characters of the string. &lt;/p&gt;
&lt;p&gt;See &lt;a href="https://docs.appian.com/suite/help/23.2/fnc_text_left.html"&gt;docs.appian.com/.../fnc_text_left.html&lt;/a&gt; for more details&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>