Skip to main content
kavyan471063
Known Participant
Sep 10, 2024 1:53 PM UTC
Question

Docx from Dynamic template with table of empty data not showing table headers

Hi All,

  I have a template document where it has 3 statements and then a table which will display data . But if the data is empty, the table header is also not displaying . But I need the output doc to display the template. table with header row showing no data available. Is this possible, Please suggest some solutions.

a!localVariables(
  local!queryXML:  if(
    toboolean(ri!isFormat)=true(),
    ri!data,
    a!forEach(
      items: reject(fn!isnull,{ri!data}),
      expression: 
      ""
    )
  ),
  if(
    a!isNullOrEmpty(ri!data),
    "",
    if(
    toboolean(ri!isSplit)=true(),
    local!queryXML,
  ""&
  ""&ri!product&""&
  ""&rule!DIL_testNewDateFormat(date: ri!dateFrom)&" to "&rule!DIL_testNewDateFormat(date: ri!dateTo)&""&
  ""&ri!type&" listing"&
  if(
    ri!type = "Unblinded",
    "Unblinded Safety Data : Do not share with blinded study personnel",
    ""
  )&
  local!queryXML&
  ""
)
)
)
see attachment/resized-image/__size/640x480/__key/communityserver-discussions-components-files/19/pastedimage1725976361949v1.png

    3 replies

    somasundaram.d
    Employee
    Sep 10, 2024 4:17 PM UTC

    Yes Its possible, try the following code in your docx template.

    Also you need to change the xml in case you do not have any data for the table

    XML for valid values

    XML for empty values

    This will give you the following results

    or

    .             

    somasundaram.d
    Employee
    Sep 15, 2024 2:56 PM UTC

    [mention:817bec9e1524451bac42dbc8c66c6a3b:e9ed411860ed4f2ba0265705b8793d05] Did this work?

    somasundaram.d
    Employee
    Sep 11, 2024 5:29 AM UTC

    Please try this