Skip to main content
August 12, 2021
Question

link label dynamic text display

  • August 12, 2021
  • 5 replies
  • 0 views

Hi

My use case is as follows. 

I have a button that initiates a process that creates an excel follow. 

After pressing the button, and upon successful creation of the excel file, I want to display to the user a document download link.

As for the label of this link, I want it to say "Download + FileName", where the file name is a Local Variable 

for example, I want the label of the link to say "Download Excel File Number 5" for example

Is there a way to make the label field dynamically displayed based on the value of a local variable. 

    5 replies

    danny.verb
    August 12, 2021

    Yes, in the 'label' field of the documentDownloadLink() you can do `"Download "&document(local!myDoc,"name")`

    August 12, 2021

    Thank you for the reply Danny, I receive this error when I use the proposed solution [label: `"Download "& local!documentName`]

    "Expression evaluation error: Syntax error. Details: Expression evaluation error : Invalid character found in expression: ` (96)"

    danny.verb
    August 12, 2021

    The ticks I used were just for this chat, you should remove them

    mikes0011
    Brainy
    August 12, 2021

    As a tangent, I recommend using only the Rich Text Display Field to show document download links (there's no reason to use a!linkField() anymore, for any reason IMHO).  The primary reasoning here is that in the RTDF, the link can be enabled/disabled dynamically, and at the same time, you can easily add extra elements like icons if/when you choose.

    Example:

    a!richTextDisplayField(
      value: a!richTextItem(
        text: {
          local!documentName
        },
        link: a!documentDownloadLink(
          document: local!generatedDoc,
          showWhen: not(isnull(local!generatedDoc))
        )
      )
    )

    The Expression Guru