<?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>Invalid Function &amp;#39;document&amp;#39;</title><link>https://community.appian.com/discussions/f/user-interface/9793/invalid-function-document</link><description>Hi all, our team want to create a validation on the fly to verify the size of a document that is uploaded. However, it&amp;#39;s giving this error: Error evaluating function &amp;#39;document&amp;#39; : Expression evaluation error : Invalid function document. Is there any way</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Invalid Function 'document'</title><link>https://community.appian.com/thread/43180?ContentTypeID=1</link><pubDate>Tue, 14 Feb 2017 16:05:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9af9de83-efe2-446a-964f-3cd254cc0f94</guid><dc:creator>fredericom</dc:creator><description>Thank for the useful inputs guys. Best Regards&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Invalid Function 'document'</title><link>https://community.appian.com/thread/43179?ContentTypeID=1</link><pubDate>Tue, 14 Feb 2017 15:54:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:14e00da1-65cc-4846-8037-1b1dc0dfc12b</guid><dc:creator>Mike Schmitt</dc:creator><description>@Philb: I&amp;#39;ve had a chance to test in 17.1 after seeing someone claim it stopped working in another thread - it still seems to work the exact same way for me and the user who made that claim never followed up with any further detail when I asked.  So for now it&amp;#39;s probably not a concern.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Invalid Function 'document'</title><link>https://community.appian.com/thread/43178?ContentTypeID=1</link><pubDate>Tue, 14 Feb 2017 15:10:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:fd36e8a6-d905-4b96-b8c1-3ddef4dbccba</guid><dc:creator>PhilB</dc:creator><description>Just as a heads up, I&amp;#39;ve heard that the workaround suggested by venkatesh above no longer works on 17.1 - maybe worth testing though.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Invalid Function 'document'</title><link>https://community.appian.com/thread/43173?ContentTypeID=1</link><pubDate>Tue, 14 Feb 2017 12:56:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2b7cb378-5e5f-461a-837f-8377554e23d6</guid><dc:creator>Mike Schmitt</dc:creator><description>@fredericom, backing up a little bit, you should be aware that you can&amp;#39;t use document() to access properties for a just-uploaded file on a SAIL form because the uploaded document lives in a special temporary system folder which is not user-accessible except through a!fileUploadField.  The &amp;quot;standard recommendation&amp;quot; from Appian is to verify file properties after submitting a form and seamlessly looping back onto the form again, as Reggie says above, because after form submit you have access to the actual document ID / properties.&lt;br /&gt;&lt;br /&gt;Users have discovered a workaround similar to what Venkatesh suggests above - i.e. you pass the local variable containing the newly uploaded file back through a!fileUploadField to get certain Dot Properties that can tell you some information about it, namely filename and size.  &lt;br /&gt;However it is important to note that the uploaded document size readout this gives is *rendered as plaintext and abbreviated* - i.e. &amp;quot;5 kb&amp;quot;, &amp;quot;2.3 mb&amp;quot;, so a simple numeric operator will not work by itself.  If one has critical need of doing size comparison on-form, you&amp;#39;d need to write a custom expression rule that takes different size text values and parses them to a standardized value (i.e. multiply out to get bytes for the various different suffixes), and live with dealing in approximate values at the end of the day.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Invalid Function 'document'</title><link>https://community.appian.com/thread/43172?ContentTypeID=1</link><pubDate>Tue, 14 Feb 2017 12:49:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2fcc6f00-5202-4062-ba3e-ee426e6ec733</guid><dc:creator>venkateshamu</dc:creator><description>Hi fredericom, This may help you!!!&lt;br /&gt;&lt;br /&gt;a!fileUploadField(&lt;br /&gt;  value: ri!doc,&lt;br /&gt;  saveInto: ri!doc,&lt;br /&gt;  validations:{&lt;br /&gt;    if(&lt;br /&gt;      a!fileUploadField(value:ri!doc).uploadedDocumentSize &amp;gt; 100 /*in KB&amp;#39;s*/,&lt;br /&gt;      &amp;quot;Exceed maximum size&amp;quot;,&lt;br /&gt;      &amp;quot;&amp;quot;&lt;br /&gt;    )&lt;br /&gt;  }&lt;br /&gt;)&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Invalid Function 'document'</title><link>https://community.appian.com/thread/43170?ContentTypeID=1</link><pubDate>Tue, 14 Feb 2017 12:08:33 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:27c6f346-0b53-4356-9206-0587da034fcd</guid><dc:creator>reginaldm377</dc:creator><description>Idk how practical this will sound to you, but you could psuedo submit the form after an upload and re-loop back into the form (in a way that is not noticeable to the user) so the document IDs are updated &amp;amp; become valid if it is imperative the validation is done right after upload.&lt;br /&gt;&lt;br /&gt;Maybe another practitioner has a better solution.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Invalid Function 'document'</title><link>https://community.appian.com/thread/43169?ContentTypeID=1</link><pubDate>Tue, 14 Feb 2017 10:42:57 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2ff0d454-eb58-481e-9d42-9946affc167a</guid><dc:creator>fredericom</dc:creator><description>...!buttonLayout(&lt;br /&gt;primaryButtons: {&lt;br /&gt;a!buttonWidgetSubmit(&lt;br /&gt;label: &amp;quot;Submeter&amp;quot;,&lt;br /&gt;style: &amp;quot;PRIMARY&amp;quot;,&lt;br /&gt;saveInto: {}&lt;br /&gt;)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;),&lt;br /&gt;validations: { &lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;)&lt;br /&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>