Unable to hide tables successfully

Use Case: Generate a customer specific price list with the click of a button.

Solution: I have built a MS Power App the user interacts with to request a price list for a customer with the click of a button. The Power App starts a Power Automate flow that includes the “Start Document Generation Process with JSON” action. I have built a very simple docx template using your online google docs builder. Each price list should optionally include 9 categories of product. The JSON sent to the doc engine includes key value pairs that inform the engine which categories to include on the document. If the section flag is set to true, the engine should populate a table with the pricing details included in the JSON. If the section flag is false, the engine should hide the table. I’m using an #if statement to hide the tables.

I cannot get the docx template to render correctly. Specifically, the engine only populates one of the tables and seems to skip the rest regardless of how the section flag is set (true or false).

I have attached payload.csv which is the JSON sent to the engine. Payload.csv also contains the pricing details for each “section” object.

I have also attached a much stripped down version of the template. The template only contains 2 sections for simplicity rather than the full 9 sections.

Can you help me understand where I’m going wrong?

payload.csv (95.7 KB)

template.docx (20.3 KB)

Hello @chrissupclay ,

Currently, there is an issue in the Modern Engine when working with data from different arrays that are not nested within each other. Because of this, you are seeing the unexpected behavior and errors in the resulting file.

Our developers have been working on a fix, and we plan to publish it at the beginning of next week. Once the update is released, your template should work correctly.

This issue is also related to another similar request: Loops in Docx modern engine.

I'll let you know as soon as the release with fixes is available.

Hello @chrissupclay ,

Our developers investigated this further and have fixed one of the issues. Now I can offer you an updated template for your solution. Please try it and let me know the results!

template_updated.docx (4.2 MB)

Additionally, please make sure that you are using the Modern engine with this template.

Best regards,
Aleksandra
Plumsail team

Hi Aleksandra,

I have completed some testing and it appears the template is working as expected. Thank you for your help!

Chris

1 Like