document function is working to get size and extenstion

HI team,

i want to find the type of extension and Size of list of documents and i have used document function and build an expression rule it is working fine in expression rule as expected when i call that expression in an interfcae  it is shoowing error as document function is deleted. 

a!localVariables(
  local!size: a!forEach(ri!documents, document(fv!item, "size")),
  local!extension: a!forEach(
    ri!documents,
    document(fv!item, "extension")
  ),
  toboolean(
    and(and(reject(
      fn!isnull,
      {
        a!forEach(
          local!extension,
          if(fv!item <> "pdf", false, null)
        )
      }
    )),
    and(reject(
      fn!isnull,
      {
        a!forEach(
          local!size,
          if(fv!item > 5000000, false, null)
        )
      }
    )
    )))
  
)

when i use in interface getting error as shown below

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Appian Employee
    in reply to Mike Schmitt

    There has been some discussion on this internally, but I don't have much of an update at the moment unfortunately. Like Mike said, the best approach at the moment is still to validate using fv!files, and keep adding your use cases.

    For instance, I'd be very interested in understanding more about this use case why it is important to disable the button over using the out-of-the-box validation behavior (where it prevents form submission).

Children
  • 0
    Certified Lead Developer
    in reply to Peter Lewis
    I'd be very interested in understanding more about this use case why it is important to disable the button over using the out-of-the-box validation behavior (where it prevents form submission).

    I can do the "devil's advocate" position on this one pretty easily: it's often desired to have a "Save Changes" button which skips *most* validations but still validates some more important things (for instance, validating that some text fields don't contain database-breaking lengths, or that there aren't files in place that would be problematically large).  Since the simple "validation group" concept doesn't actually handle this, one of my personal favorite workarounds is disabling the "save changes" button when something exists that shouldn't be saved.  (There was an entire debate about this just earlier this morning in the Discord).  But for this use case, of course, even that isn't directly possible.

  • 0
    Appian Employee
    in reply to Mike Schmitt

    Yeah that's a good use case, the context is helpful! I always appreciate a good use case because it gives a better picture into what the overall goal is - like in this case it would be great to have improvements to both validations AND document previews Slight smile