Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
7 replies
Subscribers
5 subscribers
Views
3286 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Plug-Ins
Hi All, I was trying to use the Advanced Document Templating to gene
lins
over 10 years ago
Hi All,
I was trying to use the Advanced Document Templating to generate a word document for the data queried from Query Database. This is my query:
SELECT
projectname
,activitycategory
,activitydescription
,activitytype
,type
,updatedate
FROM ptcprojectupdate
INNER JOIN ptcupdate on ptcprojectupdate.ptcupdate_projectupdates_a_id = ptcupdate.a_id
Where ptcprojectupdate.projectname = ac!project
After running this query, I put everything into a grid in an email using the "ncolumntable" function (see attachment AppianQ18).
Now, I want to put the data into a word document instead of putting into the grid in an email.
However, I have some trouble defining the structure of my template and mapping my pv (s) into the grid. I have attached my template and Xml data input data part (I just tried one variable "project").
Can someone take a look and let me know where I did wrong? Any help would be much appreciated....
ADT Question.zip
OriginalPostID-147532
OriginalPostID-147532
Discussion posts and replies are publicly visible
Parents
0
Corrado de Candia
Appian Employee
over 10 years ago
Hi Lin Shi,
Please have a look below. I've explained how to implement is and provided with an example. I've not tested the expressions written below as I've just written them.
Let me know if it solves your issue.
Output of the query (array of type!projectname):
={
{activitycategory:"ac1", activitydescription:"ad1", activitytype:"at1", type:"t1", updatedate:"u1"},
{activitycategory:"ac2", activitydescription:"ad2", activitytype:"at2", type:"t2", updatedate:"u2"}
}
XML correspondent to the output of the query (this will be the output of the rule for generating XML):
<project>
<projectname activitycategory='ac1' activitydescription='ad1' activitytype='at1' type='t1' updatedate='u1'/>
<projectname activitycategory='ac2' activitydescription='ad2' activitytype='at2' type='t2' updatedate='u2'/>
</project>
Main rule for generating a dynamic XML:
rule!mainRuleXml(ri!arrayOfProjectName):
=with(
local!arrayOfXmlTagProjectName:joinarray(apply(rule!generateXmlTagFor1Row, ri!arrayOfProjectName), " "),
"<project>" &
local!arrayOfXmlTagProjectName
& "</project>"
)
Sub Rule:
rule!generateXmlTagFor1Row(ri!currentProjectName):
=""<projectname activitycategory='" & toHtml(ri!currentProjectName.activitycategory) &
"' activitydescription='" & toHtml(ri!currentProjectName.activitydescription) &
"' activitytype='" & toHtml(ri!currentProjectName.activitytype) &
"' type='" & toHtml(ri!currentProjectName.type) &
"' updatedate='" & toHtml(ri!currentProjectName.updatedate) & "'/>"
fn!joinarray is used to convert an array of string XML tags in just one string XML
fn!toHtml is used to convert in HTML code special chars that can be in the array of CDT and interfhere with the XML definition (such as the char &)
I suggest you to follow these steps for the development:
1. Use the xml example that I provided you to verify that the docx is actually working fine
2. Implement the rules for the dynamic XML generation and use it instead of the XML sample
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
Corrado de Candia
Appian Employee
over 10 years ago
Hi Lin Shi,
Please have a look below. I've explained how to implement is and provided with an example. I've not tested the expressions written below as I've just written them.
Let me know if it solves your issue.
Output of the query (array of type!projectname):
={
{activitycategory:"ac1", activitydescription:"ad1", activitytype:"at1", type:"t1", updatedate:"u1"},
{activitycategory:"ac2", activitydescription:"ad2", activitytype:"at2", type:"t2", updatedate:"u2"}
}
XML correspondent to the output of the query (this will be the output of the rule for generating XML):
<project>
<projectname activitycategory='ac1' activitydescription='ad1' activitytype='at1' type='t1' updatedate='u1'/>
<projectname activitycategory='ac2' activitydescription='ad2' activitytype='at2' type='t2' updatedate='u2'/>
</project>
Main rule for generating a dynamic XML:
rule!mainRuleXml(ri!arrayOfProjectName):
=with(
local!arrayOfXmlTagProjectName:joinarray(apply(rule!generateXmlTagFor1Row, ri!arrayOfProjectName), " "),
"<project>" &
local!arrayOfXmlTagProjectName
& "</project>"
)
Sub Rule:
rule!generateXmlTagFor1Row(ri!currentProjectName):
=""<projectname activitycategory='" & toHtml(ri!currentProjectName.activitycategory) &
"' activitydescription='" & toHtml(ri!currentProjectName.activitydescription) &
"' activitytype='" & toHtml(ri!currentProjectName.activitytype) &
"' type='" & toHtml(ri!currentProjectName.type) &
"' updatedate='" & toHtml(ri!currentProjectName.updatedate) & "'/>"
fn!joinarray is used to convert an array of string XML tags in just one string XML
fn!toHtml is used to convert in HTML code special chars that can be in the array of CDT and interfhere with the XML definition (such as the char &)
I suggest you to follow these steps for the development:
1. Use the xml example that I provided you to verify that the docx is actually working fine
2. Implement the rules for the dynamic XML generation and use it instead of the XML sample
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data