Hi,
I am validating just uploaded document size with below code:
if( rule!APN_isBlank(ri!documentId),
{ fullName: null(), name: null(), ext: null(), size: tointeger(null()) },
a!localVariables(
local!value: a!fileUploadField(value: todocument(ri!documentId), target:cons!RMO_FOLDER_ALL_DOCUMENTS, fileNames: fv!file),
local!fileDetails: tostring(local!value.contents.value.filename),
local!fileName: extract(local!fileDetails, "[name=", ", extension" )[1], local!fileExt: extract(local!fileDetails, "extension=", ", size")[1], local!fileSize: tointeger(extract(local!fileDetails, "size=", "]")[1]), { fullName: local!fileName & if(rule!APN_isBlank(local!fileExt), "", "." & local!fileExt), name: local!fileName, ext: local!fileExt, size: local!fileSize } ))
Issue: After clicking on submitting button, document name storing as [name=Document Name, extension=docx, size=3752844] instead of only document name in KC.
Can anyone let me know how to store only document name instead of all above details in KC.
Discussion posts and replies are publicly visible
You must index into fv!file such as fv!file.name
Docs
I already tried this but it's not helping me out. If I use fv!file.name for filenames parameter validation is not happening on size.
suggest if you have any other thoughts!!
Also, you really shouldn't have a fileuploadfield within a local variable
I'm failing to understand what you're trying to do.
In validations, you have access to fv!files.size (note spelling, it's "fv!files", not "fv!file"). The Size returns size in bytes. You validate against this. There's no need for the crazy bending-over-backwards you're demonstrating here in your local variable setup.
FWIW you really need to insert code like this into a code box for it to retain any sense of readability.
True, I used to know the properties of just uploaded documents and doing the validation on the size and its perfectly working fine but only issue is with document name.
Is there any other way where we can know the properties of just uploaded document with out submitting form?
I am not using validate as true on form submission, I want to display a error message on the documents which has more than specified size on the documents which are not yet submitted.
Unknown said: I want to display a error message on the documents which has more than specified size on the documents which are not yet submitted
But this is, quite literally, what the validations parameter would do for you. In what way does that normal setup not satisfy your use case?