Hello.
I am getting the following error when attempting to import an excel workbook into Appian.
From the Interface screen (FYI... I do not have a Line 41)
Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!fileUploadField [line 6]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function a!multipleFileUploadField_getEvalFileName [line 41]: Unexpected number of parameters.
a!formLayout( label: "Import Excel Details Report", contents: { a!sectionLayout( contents: { a!fileUploadField( label: "File Upload", labelPosition: "ABOVE", value: ri!ExcelData, saveInto: ri!ExcelData, target: cons!Excel_imported_files_pointer, fileNames: "Excel Data " & now() & " " & user(), validations: {} ) } ) }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Import", submit: true, style: "PRIMARY" ) }, secondaryButtons: { a!buttonWidget( label: "Cancel", value: true, saveInto: ri!cancel, submit: true, style: "NORMAL", validate: false ) } ))
Discussion posts and replies are publicly visible
I think that this line is the issue
fileNames: "Excel Data " & now() & " " & user(),
The error message you see comes from the internal implementation. You try to call the user() function without passing any value. That will not work.
That's a strange error message. I noticed the issue with "user()" right around the same time I saw stefan's comment beat me to it (drats!) - i think you might be looking for the "loggedinuser()" function, which returns the current viewer's username.
Further, I believe the "fileNames" parameter requires an array, unless you're limiting the upload field to a single file (which you have not done). And I would note that you're overwriting the original file's name (which you may intend to do), but also, "now()" will assign some characters (forward slashes, colons, etc) to the filename which will not be compatible with files that you want users to download back to their system (in case that's relevant in this case), so I'd suggest you sanitize that before including it in a filename.
In file name parameter you had used user() in which two parameters: "property" and "username" should be present. Including these two parameters when calling the function is essential for its proper functionality.
For Example: user(username: loggedInUser(),property: "firstName")
Add these parameters then it will work perfectly.
Thank you all for the help. Every suggestion worked.