Hiding a image not a Row DocX

An overview of what we are after:

  • Why is the template formula sometimes appearing in the generated document?
  • How do we display images if one row does not have any images whilst still displaying the rows which do?

The issue we are having:

We want to generate a document for inspections carried out against a job. A document needs to be generated for each job - it should list all the inspections against that job.

We get the job and inspection info from SQL using a flow. We get the images against each inspection using SharePoint also within the flow.

We then construct some JSON ready to be sent to Plumsail which contains all of the relevant job info, inspection info and the image base64 which is retrieved from SharePoint.

For the collection of inspections, there are sometimes some inspections without images. The issue is, trying to display both the inspections WITH images and the ones WITHOUT.

See the below image for the formulas attempted in our template document


Here, we have the 'master' table which displays the inspections - {{SiteInspections}} array. For an inspection, we also have a textbox seen in image which also has a table in it - this is used to handle the orientation of the images.
Here we display {{SiteInspections.SiteNoteImages}}, which should display an array of images for that inspection.

One instance of the issue is that when an inspection without images is inserted, the template formula, :hide-block-if-empty will hide the inspection row. The :hide-block-if-empty block has been removed from the document attached for our troubleshooting. We only want to hide the images table (within the textbox) should there not be any images. So, for an inspection without images, we still want to see the inspection row, but just with no images.

FYI, the textbox for the images was used to handle the orientation of the images.

FYI, in the case that we DO have images for each inspection, the document is generated correctly - see this example:

all inspections WITH images.docs

Sometimes we have the case where the formula is displayed in the generated document but only for SOME inspection rows - very strange.

Here is the attached template document with the template formulas we are using:

template document used.docx

Here is an overview of the flow steps:


Above, is an overview of the flow steps we are using.

We want to collect inspections for a particular job. Then, for each of those inspections, we want all the images captured (which are stored in SharePoint).

The final JSON step you can see is the one sent to Plumsail.

I understand this may be a lot of information but we will hopefully be able to collaborate to reach the solution.

Thanks
502408 json.txt (1.9 MB) all inspection WITH images.docx (88.6 KB) template document used.docx (147.7 KB)

Hi @roy.nimbi

I replied in the support ticket. Please check it out.

Best regards,
Petr Bushuev
Plumsail team

@Petr suggestion.
You don't need to use hide-block-if formatter for this. If you provide any data for the image tag it's shown if not, it's hidden automatically.

For example, If I have this simple template

image

and don't use the img tag in the JSOn at all, it shows only the description

image

image

So, if you provide the base 64 code - it shows the picture or even if you provide any text for the tag it's activated, if it's empty then it's hidden.

Thank you for your email reply as this method has corrected our issue and it is producing the almost proper result,

we are looking into 1 more issue in Plumsail that we see but now confirming if it is a workflow problem.

Thank you @Petr for your swift reply.
Will send a email later to let you know if Plumsail is working correctly or we are still having that 1 issue.

1 Like