List or Foreach?

27 views
Skip to first unread message

Lee Standell

unread,
Dec 4, 2020, 2:44:11 PM12/4/20
to floreysoft
Hi, 

I'm trying to build out a document using ultradox. 

I'm sending a CALL request to a system I use called Bubbles API and I'm returning the JSON. 

I can get all the single item data to show in the document but I can't get a list of images to show up. 

The JSON returned is

{
    "response": {
        "Observations" :  [
               {
                   "IssueDescription":   "Tap is Leaking",
                   "Category":  "Plumbing",
                   "Recommendations":  "Plumber to attend and fix"
                   "ObservationImages":  [
                       "https://firstimageurl.png",
                       "https://secondimageurl.png",
                       "https://thirdimageurl.png",
],
                  "CreatedBy":  "Joe Bloggs",
                  "CreatedOn":  "22/03/2020"
                }


When I print one of the single values into my Document Template I use 

${response.Observations.IssueDescription} and this works but I can't work out how to print out the list of the images. 

Can someone help? Been stuck on this for weeks now :(



Lee Standell

unread,
Dec 4, 2020, 2:51:21 PM12/4/20
to floreysoft
Sorry the JSON should look like this, 


{
    "response": {
        "Observations" :  [
               {
                   "IssueDescription":   "Tap is Leaking",
                   "Category":  "Plumbing",
                   "Recommendations":  "Plumber to attend and fix"
                   "ObservationImages":  [
                       "https://firstimageurl.png",
                       "https://secondimageurl.png",
                       "https://thirdimageurl.png",
                  "CreatedBy":  "Joe Bloggs",
                  "CreatedOn":  "22/03/2020"
                ],

Daniel Florey

unread,
Dec 4, 2020, 5:52:55 PM12/4/20
to floreysoft GmbH
Did you try something like this?
${foreach response.Observations.ObservationImages[] observationImage}
${observationImage;image(width=5cm)}
${end}
It should print all images.
${response.Observations.ObservationImages[0];image(width=5cm)}
Should print the first one (as an example).


--
You received this message because you are subscribed to the Google Groups "floreysoft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to floreysoft+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/floreysoft/4a4cfd41-89e5-4e21-9563-e2d22cb24589n%40googlegroups.com.

Lee Standell

unread,
Sep 22, 2021, 1:20:58 PM9/22/21
to floreysoft
Hi, 

I've come back to this nearly a year later as I worked out what the issue 'is' but not sure in how to fix it. 

When the image is sent over in the Json data it's missing the initial https: (this is how the server sends it over) so I only get  //s3.amazonaws.com/appforest_uf/f1631303191127x846284253131121700/IMG_5452.JPEG for example. 

This is what the placeholder in my template looks like  ${response.Inspections.ReportFrontImage;image(width=200px;height=200px)}

How can I 'Concantenate' (think thats the right term) together :) 



Reply all
Reply to author
Forward
0 new messages