Skip to main content
September 26, 2021
Question

get image from folder

  • September 26, 2021
  • 11 replies
  • 0 views

Hi!

i created a cdt with an imageID then in an interface i designed a file upload with the target pointing to a documents folder and a save into and value of ri!product.imageId, now on an approval interface i want to display those images, i tried this:  a!documentImage(todocument(tointeger(ri!product.imageId))).document but i get this as an error: Interface Definition: Expression evaluation error at function a!imageField [line 77]: An image gallery component [label="Item's Pictures"] has an invalid value for "images" at index 1. None of the values in "images" can be null. 

Is it because i didnt save to the database yet or another problem?

    11 replies

    September 26, 2021

    and how do I fix it?

    September 27, 2021

    Can you try a!documentImage(todocument(ri!product.imageId)) and also check if the document is the available in the folder.

    stefanhelzle0001
    Brainy
    September 27, 2021

    First make sure the data flow in your process is correct. Validate this by opening the process instance in monitoring and check whether your process variables have the expected values.

    I think that you can reduce your code to

    a!documentImage(ri!product.imageId)

    Appian will happily cast your data types to the target data type. Keep in mind, this works almost perfectly for assignments, not for comparisons.

    September 27, 2021

    As you can see in the imageId the data is passing throw after submiting the form, when i type a!documentImage(
    ri!product.imageId

    i get this error message now: Interface Definition: Expression evaluation error at function a!imageField [line 72]: The image at index 1 in an image gallery component [label="Item's Pictures"] has an invalid value for "document". "document" must not be null.

    stefanhelzle0001
    Brainy
    September 27, 2021

    Do you pass the data into the user input task?

    Seems like you configured the field in the CDT as an integer. Please change that to "Document". Appian will still persist the id to DB, but I think the rule input used to store uploaded document must be of type Document.