Skip to main content
February 2, 2023
Question

Get Filename In Process model

  • February 2, 2023
  • 3 replies
  • 0 views

On file upload I want to change [Document:1234] to fileName.png.
Here is what I have currently

I've tried various expression in

But whatever I do, I don't get the filename saved in a variable.
Things tried include (but I may have done them wrong):

  • using a a!map
  • using the document(documentId,"name")
    • however [Document:1234] is not a number
    • using a!replace(pv!file,"Document:",""), and that did not work

I simply need to get the Document Id value so that I can use the document() function.
I feel that I'm running out of things to try.

Here is my input

    3 replies

    mikes0011
    Brainy
    February 2, 2023

    if pv!image is a "document" type variable, then when it's populated it's really just an alias for the Document ID.  You can call document() on it - as an object of "document" type will cast to the document ID when the rule is called on it.  What happens when you try this?

    The Expression Guru
    stefanhelzle0001
    Brainy
    February 2, 2023

    This "[Document:1234]" is just the way Appian displays this value to you. Like Mike mentioned, call the document() function on it as it internally is only an integer.

    abhayd3663
    February 12, 2023

    Following should definitely work - 

    document(todocument(5454),"name")

    Note: Replace 5454 with the process variable.