Displaying documents with text in Document viewer

Certified Associate Developer

Hi every one,

If file is missed or corrupt, I wanna the text display "No find image" instead of text "Document not avaiable", like image below.

Thanks a lots.

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    Document corrupt is very rare chance in Appian but to show the something else then you can use the if else condition and show the error if the condition is false.

    Something like below:

    a!localVariables(
      local!documentAvailable: getcontentobjectdetailsbyid(ri!docId),
      local!doc: if(
        local!documentAvailable = "No object with this ID has been found",
        {},
        if(
          keyval(
            local!documentAvailable,
            "Type",
            ": ",
            ", Created"
          ) = "Document",
          document(ri!docId, "extension"),
          {}
        )
      ),
      if(
        local!doc = "pdf",
        a!documentViewerField(
          document: todocument(ri!docId)
        ),
        a!cardLayout(
          style: "STANDARD",
          contents: {
            a!richTextDisplayField(
              align: "CENTER",
              value: a!richTextItem(text: "No find image")
            )
          }
        )
      )
    )

  • If the file is corrupted, then there is no way to find it but if the document is not displayable, then you can use a card layout instead of the document viewer to show the message.