Appian Community and Appian Academy are being upgraded. As a part of the upgrade, Appian Community is currently in read-only mode, and user registration is disabled until August 3. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!

The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.

Advanced Document Templating

Certified Lead Developer

How can I iterate the whole table for the requirement? How should the syntax be placed for Advanced Document templating plugin. I understand the code how we can loop through the rows in a grid but how can we loop the grid itself? eg: If I have 5 employees under Labor grid I want 5 different grids dynamically created based on syntax! 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    You cannot loop the grid itself; instead, build XML with repeated <employee> nodes using a!forEach and concat, then wrap the entire table inside a repeat block for each employee in your DOCX template so 5 employees produce 5 separate grids.

    See this example

    a!localVariables(
      local!labor: {
        a!map(name: "John", id: "101", role: "Developer"),
        a!map(name: "Mary", id: "102", role: "Tester"),
        a!map(
          name: "Sam",
          id: "103",
          role: "Business Analyst"
        )
      },
      concat(
        "<project>",
        "<labor>",
        joinarray(
          a!forEach(
            items: local!labor,
            expression: concat(
              "<employee>",
              "<name>",
              fv!item.name,
              "</name>",
              "<id>",
              fv!item.id,
              "</id>",
              "<role>",
              fv!item.role,
              "</role>",
              "</employee>"
            )
          ),
          ""
        ),
        "</labor>",
        "</project>"
      )
    )

  • 0
    Certified Lead Developer
    in reply to Shubham Aware

    How do we write the repeat block logic for per employee in WORD as you mentioned?

Reply Children