We are on 17.1 version of Appian, I have a requirement to validate the uploaded document size
I have a requirement to validate the uploaded document size. Once the user has uploaded the file needs to be validated before submitting the form. so here I can not use document function.
tried several approaches like
a!fileupload(
value:ri!document,
target:"ABC LOCATION"
).uploadedDocumentSize
the above approach is working in expression rules but at run time it is giving me an error saying that text can not convert to Layout.
Approach 2
a!fileUploadField_17r1( value: ri!document ).uploadedDocumentSize
Above approach is giving error message saying that Invalid function fileUploadField_17r1
Discussion posts and replies are publicly visible
Thank you all for your response,
the above-attached code snippet solved my problem
root cause: In 17.1 version, file upload component is having a different set of attributes in design view and in the live view (execution time)
if( or( rule!APN_isBlank( ri!document ), tointeger( ri!document ) <= 0 ), { fullName: "", name: "", ext: "", size: "" }, with( local!value: a!fileUploadField( value: ri!document ), if( rule!APN_isBlank( property( local!value, "uploadedDocumentName", null() ) ), /* get properties as rendered in 17.1+ process forms */ if( rule!APN_isBlank( property( property( local!value, "contents", null() ), "name", null() ) ), { fullName: "", name: "", ext: "", size: "" }, { fullName: local!value.contents.name & "." & local!value.contents.extension, name: local!value.contents.name, ext: local!value.contents.extension, size: local!value.contents.size } ), /* for old style form rendering (pre-17.1, or in 17.1 interface designer) */ with( local!fullName: local!value.uploadedDocumentName, local!parts: split( local!fullName, "." ), local!extension: if( length( local!parts ) > 1, index( local!parts, length( local!parts ), "" ), "" ), local!name: if( length( local!parts ) > 1, joinarray( rdrop( local!parts, 1 ), "." ), index( local!parts, 1, "" ) ), { fullName: local!fullName, name: local!name, ext: local!extension, size: local!value.uploadedDocumentSize } ) ) ) )