Skip to main content
Legacy User
August 1, 2019
Solved

How to design template to show recurring data

  • August 1, 2019
  • 18 replies
  • 210 views

I am in need to show multiple parts information in Document generated from SpringCM.

Currently in the document template I can use merge fields to populate the data but I need to show Part name in each line, number of parts can vary from 1 to 10. How can I define the templates so contents are populated in a loop.

Best answer by Community Expert

There is a conditional tag. Unlike the current tags you have used this one will require a Match/NotMatch attribute as well as a closing tag. If the select evaluates to the value in Match or not evaluate to the value in NotMatch then the content will be displayed.

<# <Conditional Select="" Match="" /> #>Content to show or hide<# <EndConditional/> #>

<# <Conditional Select="" NotMatch="" /> #>Content to show or hide<# <EndConditional/> #>

Hope this makes sense.

18 replies

Legacy User
August 2, 2019

If you are using a Table you can use the new TableRow tag to the root of your repeating XPath, if not using the old Repeat tags with the same Path will work. For the internal contents you will need your usually Content tags but the XPath will be relative to you TableRow or Repeat tag.

So:

<# <Repeat Select="//Locations_Container/Locations" Optional="true" /> #>

<# <Content Select="./Location_Name" Optional="false" /> #>

<# <EndRepeat/> #>

or

<# <TableRow Select="//Locations_Container/Locations" /> #> in any cell of the table row you want repeated

<# <Content Select="./Location_Name" Optional="false" /> #> in all other cells for content output

Where:

<Locations_Container>

<Locations>

<Location_Name />

</Locations>

</Locations_Container>

Legacy User
August 2, 2019

I used TableRow syntax and nothing was displayed on the document. Not sure what is wrong here...

tag

here is the xml I am passing

  <Account>

  <Name>XYZ</Name>

  <Contact>

  <FirstName>John</FirstName>

  <LastName>Mack</LastName>

  </Contact>

  <Contact>

  <FirstName>Robert</FirstName>

  <LastName>Chang</LastName>

  </Contact>

  </Account>

Legacy User
August 2, 2019

I see extra spaces in your TableRow select.

Also, what exactly are you getting back, nothing as in blank or nothing as in not what you want?

Legacy User
August 2, 2019

I have one space between TableRow and Select and content comes blank in the document. Content should be populated with First Name and LastName in xml.

Removing the space makes TableRowSelect one word and I get error below.

tag

Legacy User
August 2, 2019

To be clear I was stating the previous image showed extra spaces in your Select statement, not in the tag.

Legacy User
August 2, 2019

Finally I am able to generate the table with little tweaks in the definition.

tag

Thanks for your inputs @Zakee Goliak​ 

Legacy User
August 2, 2019

Great job!

So, it looks like the extra spacing is gone, which I believe is the significant change.

The other change, //Contact, is a more direct pointer to the base of the repeat. I would caution that if in the future you XML structure changes, and Account becomes nested within another Repeat, this will throw an error stating there are more than one node for the requested path.

Legacy User
August 2, 2019

I understand your point on direct pointer but I was not able to give the xpath using nested nodes. I removed the spaces what you observed but the output was blank.

For now, I don't consider another level of nesting but thats the valid use-case for other workflow.

Legacy User
August 7, 2019

Another question, I think you might have answer. How can I add conditional logic to render the table? There is possibility that table data is not coming in the xml and tables not to be generated on the document not even a header? You have been helpful so far.

Docusign Employee
August 7, 2019

There is a conditional tag. Unlike the current tags you have used this one will require a Match/NotMatch attribute as well as a closing tag. If the select evaluates to the value in Match or not evaluate to the value in NotMatch then the content will be displayed.

<# <Conditional Select="" Match="" /> #>Content to show or hide<# <EndConditional/> #>

<# <Conditional Select="" NotMatch="" /> #>Content to show or hide<# <EndConditional/> #>

Hope this makes sense.