Hide table in Docx from Dynamic Template

Hi All,

Is there a way to hide a table using the docx from dynamic template when the table doesn't have any values ?

For example, in the attached docx template, I would like to hide the second table in case an empty dataset is passed to this table.

a!localVariables(
  local!data: {
    {
      name: "John Samuael",
      branch: "CSE",
      rollNum: "abc"
    },
    {
      name: "Michelle Dsouza",
      branch: "IT",
      rollNum: "fgh"
    }
  },
  local!addressData: {
    /*{*/
      /*address: "1000 Main St",*/
      /*city: "Houston",*/
      /*state: "TX"*/
    /*},*/
    /*{*/
      /*address: "900 Main St",*/
      /*city: "Dallas",*/
      /*state: "TX"*/
    /*}*/
  },
  concat(
    "<details>",
    "<info>",
    a!forEach(
      items: local!data,
      expression: "<rowvalues name = " & "'" & fv!item.name & "'" & " branch= " & "'" & fv!item.branch & "'" & " rollNum= " & "'" & fv!item.rollNum & "'" & " />"
    ),
    "</info>",
    "<addressData>",
    a!forEach(
      items: local!addressData,
      expression: "<rowvalues address = " & "'" & fv!item.address & "'" & " city= " & "'" & fv!item.city & "'" & " state= " & "'" & fv!item.state & "'" & " />"
    ),
    "</addressData>",
    "</details>"
  )
)

0741.Dynamic Word Template.docx 

Regards,

Sidd

  Discussion posts and replies are publicly visible

Parents Reply Children