You are on the Xporter Cloud documentation. If you are looking for Xporter Server documentation, you can find it in this page.

The main goal of this exercise is to give you an idea about how Xporter works with iterations.

You'll learn how to populate the Issue Comments on 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, put the mapping #{for comments} at the beginning of the iteration section of your template, and at the end, put the mapping #{end} to close it.

Since you're iterating, put Comments[n]. 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]. at the beginning of the mapping of the Comment Field you're trying to populate. 

#{for comments}
   ${Comments[n].Author}
   ${Comments[n].AuthorFullName} 
   ${Comments[n].Body}
   ${Comments[n].Created}
   ${Comments[n].GroupLevel}
#{end}
 
#{for <VariableName>=CommentsCount}
   ${Comments[VariableName].Author}
   ${Comments[VariableName].AuthorFullName} 
   ${Comments[VariableName].Body}
   ${Comments[VariableName].Created}
   ${Comments[VariableName].GroupLevel}
#{end}

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

AuthorAuthor Full NameBodyCreated dateCreated date timeGroup Level

Below it, put the #{for comments} or #{for <VariableName>=CommentsCount} statement, so the Header is printed only once.

Then, 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}.

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

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

This Template has:

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

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

If you like this exercise, please leave a comment or a (thumbs up). Your feedback is very important to us.

Thank you in advance.

Enjoy our product. (big grin)

Here are the files related to this Exercise:

FileDescription
Exercise 1 - Template

Exercise 1 - Sample Template file

Exercise 1 - GeneratedExercise 1 - Sample generated file
  • No labels