Using Merge Field Repeat Blocks

Modified on Tue, 4 Jun at 5:49 PM

In this article:



Sometimes you will need whole sections of the document to be repeated. For example, you might want a separate signature block for each participant where each block will print the participant name and address under the signature lines.  You can also use merge field repeat blocks to create lists and tables from custom data sets defined as "multi-row".




Inserting Merge Field Repeat Blocks



To create a repeating block:

  • Edit the template and surround the block(s) as follows:
[[*REPEAT|data_source=data_source|*]]

[[*REPEAT|END*]]


In this example, the data_source tells the repeat block what to count in order to determine the number of repetitions. It can be the name of any data_source of custom data collections in the merge_field list. It can also be an action participant. 


If the Data Source is action_participant, you must further qualify this with the participant type, for example:


[[*REPEAT|data_source=action_participant.Client|*]] 

 



Examples of Data Sources


1) When pulling merge fields form a participant

Action_participant.ParticipantType


In this case ParticipantType is the name of the participant type that you are pulling information on. For example a Client, Lawyer, or Customer.

 

2) When pulling merge fields from a multi-row data collection

Data_Collection_Name


The name of the data collection that the fields you are repeating will be found under. 

 

3) When pulling information from a sales/purchase document (such as an invoice): 

SP_LineItems

 

When the document is generated, it will look at the data_source (see merge field list) to determine how many times it should be repeated. It will then substitute the * character in the repeating clock for the number of the repeat block.


NOTE:  It is important to set the record number to an asterisk within the repeat block (rn=*)

Example:

[[*REPEAT|data_source=action_participant.Client|*]]
[[Field|rn=*|pt=Client|]]
[[*REPEAT|END*]]

will translate to:
[[Field|rn=1|pt=Client|]] [[Field|rn=2|pt=Client|]] etc…


After all repeat blocks have been created, the merge fields will be substituted in the normal way.


NOTE: To merge all the participants in an action (regardless of type), use "All__Participants" (with a double underscore between All and Participants).


   

[[*REPEAT|data_source=action_participant.all__participants|*]]
[[FirstName|pt=All__Participants|rn=*]], [[ParticipantTypeName|pt=All__Participants|rn=*]]
[[*REPEAT|END*]]

 

NOTE:  In the data_source specification, action_participant must be in lowercase.





Full List of Data Sources

The availability of the data sources will depend on what type of document template is being generated; however, following is a full list of possible data sources and how to enter them: 

  • action_participant
  • receipts
  • sale_purchase_payments
  • checks
  • action_sale_payment_schedule
  • deposit_slip_items
  • sp_lineitems
  • trust_receipt_action
  • bill_fees
  • bill_expenses
  • bill_retainer
  • bill_statement_payments
  • bill_statement_trust
  • unpaid_client_invoice
  • any multi-row data-collection name




Sorting Participant Data in Repeat Blocks

The only sorting option available for participants is sort=name. Name must be in all lowercase.


Example:

[[*REPEAT|data_source=action_participant.Client|sort=name|pt=Client|direction=asc|*]]
[[Field|rn=*|pt=Client|]]
[[*REPEAT|END*]]




Sorting Multi-Row Custom Data Elements in Repeat Blocks

By default, the multi-row custom data elements will be sorted by the order they were added to the matter (Record Number). To sort by specific columns, add a sort directive to the merge field. Valid values for sort are as follows. (Note that column numbering starts at zero.)

  • |sort=0,4,2 will sort a comma-separated list of columns in the order you specify. In this example, the data will be sorted by the first column then by the fifth and then by the third column.
  • |sort=0-3 will sort a range of columns in order by the first four columns.
  • |sort=all will sort all columns by the order of the columns in the list. This is the easiest way to do it.
  • |sort=my_custom_field_name will sort by the name of the field instead of the column number.


You can control the direction of the sort with the direction= option.

  • |direction=asc will sort in ascending order (A-Z)
  • |direction=desc will sort in descending order (Z-A)


Example:

[[*REPEAT|data_source=Equipment|sort=Make|direction=desc|*]]
[[Equipment_Location|rn=*]] [[Equipment_Make|rn=*]][[Equipment_Model_Num|rn=*]]
[[*REPEAT|END*]]




Creating Tables Using Repeat Blocks

You can create table rows for each repeat block by placing the repeat block inside a regular DOCX table in MS Word.  However problems sometimes occur because it is difficult to see where the (invisible) row markers start and end. The key to keeping all the columns together is to use the tablerow merge field option in the first REPEAT directive.


Example:

[[*REPEAT|... |tablerow|*]] … [[*REPEAT|END*]]


During this merge process, Actionstep will automatically include the start and end row tags from the template inside the REPEAT block to ensure that the whole row gets repeated rather than individual cells.




Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article