Hi All,
I'm trying to generate table in docx Using Docx From Dynamic Template. When trying with sample data and template as given below
"<info>
<rowvalues name = 'John Samuael' branch= 'CSE' rollNum= 'abc' />
<rowvalues name = 'Michelle Dsouza' branch= 'IT' rollNum= 'fgh' />
</info>"
Here its working fine and able to generate 2 row of data
But when I'm trying to generate with actual data i.e as given below
<info>
<rowvalues name = 'Gaurav' dob= '4/1/2021' requestnumber= '1' />
<rowvalues name = 'Gaurav Singh' dob= '4/1/2021' requestnumber= '2' />
<rowvalues name = 'Shahid' dob= '4/2/2021' requestnumber= '1' />
<rowvalues name = 'Shahid Salman' dob= '4/2/2021' requestnumber= '2' />
<rowvalues name = 'Prachu' dob= '4/3/2021' requestnumber= '2' />
And using template as
No data is getting populated in the grid.
I'm preparing the xml in an Expression rule, calling the rule in script task and storing the value in a text field then Passing it to the "XML Data Model"
attribute of Smart service.
Kindly let me know if something is missing.
Discussion posts and replies are publicly visible
For tables, you need something like the following in your document template:
«[#if»
Item #
Description
Unit/Issue
Quantity
«@before-row[#list doc.project.sectionFou»«${d.@number}»«@after-row[/#list]»
«${d.@description}»
«${d.@unit}»
«${d.@quantity}»
«[/#if]»
Then, in the XML Data Code, you just need to call the expression that is looping through to populate the table.
Also, have you checked the fields of your Word Template? To make sure that the respective variable is assigned to that field?
You are definitely missing the "if" portion.
doc.project.sectionFou: Is this document name or something else
or your xml is in given structure:
<project>
<sectionFou number="1"/>
<sectionFou number="2"/>
</project>
So, in the XML code, you need the name of each field to match the respective field in the template. For example:
=<project>
<sectionFourTable>" & rule!NameOfYourRule(pv!input) & "</sectionFourTable>
Then, inside of your template you should have the something similar to the code I previously used.