Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This is the first exercise of the Intermediate Level. The main goal of this exercise is to give you an idea about how Xporter works with iterations.

Here youYou'll learn how to populate the Issue Comments on a an Xporter-generated file. The mappings in use are documented here.

The section between #{for comments} and #{end} will grow dynamically according to the number of existing Comments on the Issue. In order to start iterating over Issue Comments, on put the mapping #{for comments} at the beginning of the iteration section of your template you must put the mapping #{for comments}, and on at the end, you must put the mapping #{end} to close it.

You must take into account that since Since you're iterating, you've to put Comments[n]. on at the beginning of the mapping of the Comment Field you're trying to populate. 

When using the #{for comments} statement, the variable name will always be n, . If you want to use a different variable name, like a, you must start your iteration instead with the statement #{for a=CommentsCount} and must make sure to change it properly on the Comments[a]. on at the beginning of the mapping of the Comment Field you're trying to populate. 

...

If you want to display your Comments Iteration as a Table with a Header, you must first create the Header using a table with 6 columns and 1 row:

AuthorAuthorFullnameBodyCreated dateCreated date timeGroupLevel

And below you Below it, put the #{for comments} or #{for <VariableName>=CommentsCount} statement, so the Header is printed only one timeonce.

With that doneThen, you create another table where the Issue Comments will be populated:

${Comments[n].Author}${Comments[n].AuthorFullName}${Comments[n].Body}${dateformat("dd-MM-yyyy"):Comments[n].Created}${dateformat("dd-MM-yyyy HH:mm:ss"):Comments[n].Created}${Comments[n].GroupLevel}

Finally, close the statement using the mapping #{end}.

Info

You can do this on other types of Iterations. You can check the iterations For more details, please refer to the documentation here.

Below there is a sample of how the mappings will be displayed in a Word template:

This Template has:

  • A a header with an image
  • Headings
  • Text styling
  • Table

Below there Below is a sample of how the generated file will be populated:

...

Info

If you like this exercise, please share your opinion on the page by just leaving leave a comment or a (thumbs up). Your opinion feedback is very important to us.

Thank you in advance.

Enjoy our product. (big grin)

Expand
titleClick here to see the Exercise 1 resources

Here 's the Exercise 1 related filesare the files related to this Exercise:

FileDescription
Exercise1Template

Exercise 1 Sample Template file

Exercise1GeneratedExercise 1 Sample generated file