I want to keep documents from each speaker in a separate folder. I create the folder in a separate process and store the name of the folder in a field the Record Type of Speaker. Now when I want to upload documents, I need to set the Folder parameter in the a!fileUploadField(). When I set the target to the field, i get an error that Appian cannot cast the value of Record Field into a type of folder. I guess that I have to use the Cast() function to do that. However, I can not figure out how to format the Cast function to do that. I read the documentation for Cast() and TypeOf(), but I am still lost.
target: cast( typeof("folder"),'recordType!PMSO Speaker.fields.folder'),
Could someone please let me know how to proceed?
Discussion posts and replies are publicly visible
Folder are identified by a numeric integer value, so tointeger will do it. You can also use tofolder().
Groups, Documents, and Folders on Appian have unique integer IDs for themselves. So wrapping any of these types in tointeger() will give you their ID.
Instead of folder name, you should store the unique folder id. During file upload you won't be require to cast, you may use the record field directly.
target: fv!row['recordType!PMSO Speaker.fields.folder'],
Thank you to everyone that responded. This is how i was able to fix my issue.
1. I changed the format of the folder field in the database from Text to Integer.
2. In the process model in the Create Folder smart service where I create the folder for the speaker, I created a custom output. tointeger(ac!NewFolder) and saved that to the folder id field in the speaker record.
3. In the Interface is set the target to: target: tofolder(ri!speakerRecord['recordType!PMSO Speaker.fields.speakerFolderId']),
Works like a champ!!! Thanks again!
Great to hear that.
In step 2, you can just assign the new created folder to that field. Appian will do the typing automatically. That makes the custom output unnecessary.
Appian is very good in getting the type correctly casted when assigning values. Not so much when comparing.
I tried that and still got an error. It seems that neither the text (cast from text to folder) or the integer field alone (cast integer to folder) did the trick. The to folder() function did it.
I store all document or folder references as integers and never do any casting and have zero issues. But it might be that there are a few steps in your scenario that break this.
And it might be that an integer, stored as text, does not work automatically.
I store the integer as an integer and a text as a text. Could it be that I create the folder in a process model and then store documents from the interface?
I am not sure I fully understand what you are asking?!?
Yes, you can create a folder in a process and then allow the user to upload documents to it.
I was just responding to your statement that there "might be that there are a few steps in your scenario that break this".