DOCX from dynamic template

Certified Senior Developer

How to write expression rule  and word template if i have a requirement to generate dynamic table in pdf

i am using docx from dynamic template and doc to pdf plugins

i have to generate two dynamic column 

1.Documents

2.Description 

THANKS

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Did you read the answer I gave you in this thread? https://community.appian.com/discussions/f/new-to-appian/29782/how-to-create-rule-for-docx-from-dynamic-template.

    There is some documenation and an example word document when you download the plugin here: https://community.appian.com/b/appmarket/posts/advanced-document-templating 

    There's also a word document that has an example of the table:

    Here is the XML that needs to be generated:

    <project>
    <name>This is a simple placeholder</name>
    <developer name='John' lastEmail='Smith' mail='smith@email' day='10-10-2014' /> <developer name='Frank' lastEmail='Brown' mail='frank@email' day='10-10-2014' />
    </project>

    Here's an example expression that can generate this XML:

    a!localVariables(
      local!project: a!map(
        name: "This is a simple placeholder",
        developers: {
          a!map(
            name: "John",
            lastEmail: "Smith",
            mail: "smith@email"
          ),
          a!map(
            name: "Frank",
            lastEmail: "Brown",
            mail: "frank@email'"
          )
        }
      ),
      concat(
        "<project>",
        "<name>",
        local!project.name,
        "</name>",
        a!forEach(
          items: local!project.developers,
          expression: concat("<developer name='", fv!item.name, "' lastEmail='", fv!item.lastEmail, "' email='", fv!item.email, "'/>")
        ),
        "</project>"
      )
    )

  • 0
    Certified Senior Developer
    in reply to Mathieu Drouin

     How can i access data from rule to word template

    a!localVariables(
      local!application: rule!GAI_getApplication(applicationId: ri!appId).data,
      local!projectInfo: rule!GAI_getProjectInfoDisplaySummary(appId: ri!appId),
      local!grantDocument: rule!GAI_getGrantDocument(applicationId: ri!appId, isactive: true()).data,
      local!programAssessmentChart: rule!GAI_convertPgmActvtyAssmntDataToTempData(
        pgmActvtyAssmnt: rule!GAI_getPrgmActvtyAssessmentByApplnId(applicationId: ri!appId).data,
        applicationId: ri!appId
      ),
      local!programActivity: rule!GAI_getRefProgramActivity(
        programActivityId: a!forEach(
          items: local!programAssessmentChart.fk_program_activity_id,
          expression: fv!item
        )
      ).data,
      local!now: text(now(), "DD/MM/YYYY HH:MM:SS"),
      {
        concat(
          "<dynamic>",
          "<title>",
          local!application['recordType!{5f640b2a-afca-4569-92d3-9e2938c52816}GAI Application.relationships.{abdf1474-5557-4307-87ca-cebf6144aab0}gaiOpportunity.fields.{47017e97-a5d2-4248-a00d-13cc0627e773}opportunityTitle'],
         
          "</title>",
          "<fiscalYear>",
          local!application['recordType!{5f640b2a-afca-4569-92d3-9e2938c52816}GAI Application.relationships.{abdf1474-5557-4307-87ca-cebf6144aab0}gaiOpportunity.fields.{8140c1d1-fe02-45b1-b6bc-53f76502fad9}fiscalYear'],
          "</fiscalYear>",
          "<dateTime>",
          local!now,
          "</dateTime>",
          "<projectTitle>",
          index(local!projectInfo, "projectTitle", {}),
          "</projectTitle>",
          "<projectSummary>",
          index(local!projectInfo, "projectSummary", {}),
          "</projectSummary>",
          "<startDate>",
          index(
            local!projectInfo,
            "auditPeriodFromDate",
            {}
          ),
          "</startDate>",
          "<EndDate>",
          index(
            local!projectInfo,
            "auditPeriodToDate",
            {}
          ),
          "</endDate>",
          "<judrication>",
          index(
            local!projectInfo,
            "isJurisdictionFedFunds",
            {}
          ),
          "</judrication>",
          "<fundOtherSource>",
          index(
            local!projectInfo,
            "isFundSoughtOtherSources",
            {}
          ),
          "</fundOtherSource>",
          "<nonProfit>",
          index(local!projectInfo, "isNonProfit", {}),
          "</nonProfit>",
          "<problemIdentification>",
          index(
            local!projectInfo,
            "problemIdentification",
            {}
          ),
          "</problemIdentification>",
          "<programAssessment>",
          index(
            local!projectInfo,
            "programAssessment",
            {}
          ),
          "</programAssessment>",
          "<documents>",
          local!grantDocument['recordType!{4f36bc57-dc6a-4815-9b5c-f8df2a66f30a}GAI Grant Document.fields.{02c719ff-0b99-4735-885f-f7fb13d5959d}appianDocId'],
          "</documents>",
          "<documentsTitle>",
          local!grantDocument['recordType!{4f36bc57-dc6a-4815-9b5c-f8df2a66f30a}GAI Grant Document.relationships.{2a72a602-38d8-45a3-9e4b-4f6d23472477}gaiRefDocType.fields.{87f2b9f6-fadf-469c-b7eb-0abba3d94491}docType'],
          "</documentsTitle>",
          "<ActivityName>",
          local!programActivity['recordType!{c1b3acd6-4f4f-401f-828d-b60dc3af6722}GAI Ref Program Activity.fields.{c6132d99-98ea-42d1-a06a-2c005c045e8e}activityName'],
          "</ActivityName>",
          "<year1Value>",
          local!programAssessmentChart.year1_value,
          /*index(*/
            /*local!programAssessmentChart.year1_value,*/
            /*"year1_value",*/
            /*{}*/
          /*),*/
          "</year1Value>",
          "<year2Value>",
          index(
            local!programAssessmentChart,
            "year2_value",
            {}
          ),
          "</year2Value>",
          "<year3Value>",
          index(
            local!programAssessmentChart,
            "year3_value",
            {}
          ),
          "</year3Value>",
          a!forEach(
            items: local!programAssessmentChart,
            expression: concat(
              "<ctable Activity='",
              index(fv!item, "activityName", {}),
              "' fiscalYear-1='",
              index(
                local!programAssessmentChart,
                "year1_value",
                {}
              ),
              "' fiscalYear-2='",
              index(
                local!programAssessmentChart,
                "year2_value",
                {}
              ),
              "' fiscalYear-3='",
              index(
                local!programAssessmentChart,
                "year3_value",
                {}
              )
            )
          ),
          "</dynamic>"
        )
      }
    )
    docTemplate1.docx

  • 0
    Certified Lead Developer
    in reply to Sudhir Singh

    Did you take a look at the document in the package?

    adtDocxTemplate.docx

Reply Children
No Data