Images in a grid [DOCX From Dynamic Template Smart Service]

A Score Level 1

Hi,

We have a project requirement where we need to pass an array of images into a grid, each row with a different image.

The grid is already configured, but we can't seem to manage to pass dynamically an array of images into the grid - they are appear repeated across all rows and for each row, we want the image that corresponds to that row position. For row 1, we want image 1, for row 2, image 2...

Current output

Expected output

Currently, we are defining the barcode image column like this:

And the node is configured currently as:

My suspicion is that Appian can't iterate automatically throughout the array and position each image in each row but I'm not really sure how this can be achieved.

Kind regards

  Discussion posts and replies are publicly visible

Parents
  • I know you've already worked a lot with these types of requirements. Do you mind me asking how can I achieve an output like this? We still couldn't manage to find a solution.

  • Hi ,

    It is a tricky requirement that you have. Specially because the list and the images array are not directly linked. I was wondering if you could try to apply an index for the requested image, but that means that you would need to make sure that the list size and the image array have the same size and posibily it would require you to have dynamic bookmarks and Im not sure if that is possible.

    Personally for these complex requirements I prefer to directly generate the document in PDF using XSL-FO. But even if you choose this approach, you would need to have the barcodes stored in Appian as base64, but at least you would have totally control on the document generation.

    I'll try run some tests here using FreeMaker, lest see If I can find something.

    Regards,

    Acacio B.

  • 0
    A Score Level 1
    in reply to Acacio Barrado

    Thank you so much for the feedback, !

    It is indeed a tricky requirement.

    We still couldn't come up with a solution for this... We also tried to create a CDT to map the images but the node doesn't seem to understand how to iterate throughout the list of images and place them in the correct position.

    My guess is that whenever the node runs and receives a list of images, it can't properly correlate how the information for the grid is related to the images and receive an index for each image.

    Let us know please if you think about any solution, we're still wondering how we are going to achieve the solution.

    Kind regards

  • Hi ,

    I came up with an idea, it is a solution but it is not scalable and perhaps will not suite to your case, but it is working as you expected.

    During the process to figuring out how to achieve your requirement I learned few things, for instance some of the FreeMarkers functions are not available to us, due the FreeMarker version that the plugin is using. I'm mentioning this because I was trying to use the index function, but as you can see in the documentation, the index was added to the FreeMarker in the version 2.3.23, but the current Freemarker version in the plugin is 2.3.20. So I had to use deprecated functions. Check the screenshot:

    So basically what I implemented relies in you know upfront the max number of images that you will possibly can have, the reason for that is because the Word has some kind of limitation, and in case you create more bookmarks than you have images it can be a problem.

    As I mentioned it is not a final solution, but it can definitely give you more ideas.

    Please find below the templates that I used in my tests.

     Input XML:

    <?xml version="1.0" encoding="UTF-8"?>
    <project>
      <trackingRow trackingId="TEST01"
                   reference="CL3589701"
    			    status="Accepted"
                   reported="Yes"/>
       <trackingRow trackingId="TEST02"
                   reference="CL3589702"
    			   status="Accepted"
                   reported="No"/>
       <trackingRow trackingId="TEST03"
                   reference="CL3589703"
    			   status="Accepted"
                   reported="Yes"/>
       <trackingRow trackingId="TEST04"
                   reference="CL3589704"
    			   status="Accepted"
                   reported="No"/>
       <trackingRow trackingId="TEST05"
                   reference="CL3589705"
    			   status="Accepted"
                   reported="No"/>
       <trackingRow trackingId="TEST06"
                   reference="CL3589706"
    			   status="Accepted"
                   reported="Yes"/>
    </project>
    	

    DOCX template:

    Community Test With Images.docx

    Result document:

    This is a test doc.docx

    I hope that helps you some how.

    Regards

    Acacio B.

Reply
  • Hi ,

    I came up with an idea, it is a solution but it is not scalable and perhaps will not suite to your case, but it is working as you expected.

    During the process to figuring out how to achieve your requirement I learned few things, for instance some of the FreeMarkers functions are not available to us, due the FreeMarker version that the plugin is using. I'm mentioning this because I was trying to use the index function, but as you can see in the documentation, the index was added to the FreeMarker in the version 2.3.23, but the current Freemarker version in the plugin is 2.3.20. So I had to use deprecated functions. Check the screenshot:

    So basically what I implemented relies in you know upfront the max number of images that you will possibly can have, the reason for that is because the Word has some kind of limitation, and in case you create more bookmarks than you have images it can be a problem.

    As I mentioned it is not a final solution, but it can definitely give you more ideas.

    Please find below the templates that I used in my tests.

     Input XML:

    <?xml version="1.0" encoding="UTF-8"?>
    <project>
      <trackingRow trackingId="TEST01"
                   reference="CL3589701"
    			    status="Accepted"
                   reported="Yes"/>
       <trackingRow trackingId="TEST02"
                   reference="CL3589702"
    			   status="Accepted"
                   reported="No"/>
       <trackingRow trackingId="TEST03"
                   reference="CL3589703"
    			   status="Accepted"
                   reported="Yes"/>
       <trackingRow trackingId="TEST04"
                   reference="CL3589704"
    			   status="Accepted"
                   reported="No"/>
       <trackingRow trackingId="TEST05"
                   reference="CL3589705"
    			   status="Accepted"
                   reported="No"/>
       <trackingRow trackingId="TEST06"
                   reference="CL3589706"
    			   status="Accepted"
                   reported="Yes"/>
    </project>
    	

    DOCX template:

    Community Test With Images.docx

    Result document:

    This is a test doc.docx

    I hope that helps you some how.

    Regards

    Acacio B.

Children
No Data