Purpose of this method
When working with a repeat table it is sometimes desirable to explicitly differentiate between the content collected from each row of the repeat. The simplest way to do this would be to use rpt_Index to insert the row number into the document.
By this method the output would be formatted something like this:
Applicant 1’s Name:
Applicant 2’s Name:
Where { MERGEFIELD rpt_Index } is inserting the digits on each repeated row. One would assume that if we wanted to phrase this as either ‘First Applicant’s Name’, or ‘1st Applicant’s Name’ a quick insertion of the relevant switch to the rpt_Index mergefield and some simple reordering of terms would achieve our goal. However this is not the case, and users will find that adding the switches “\*OrdText” and “\*Ordinal” will both return the unedited integer.
This is due to the fact that Word will identify the number returned by rpt_Index as a string rather than a number. But don’t despair about your ideal formatting needs not being met just yet! With a few slight tweaks to the mergefield all of the number formatting switches will be working just fine with your rpt_Index field.
Implementing the rpt_Index number format switch.
To implement this format switching method, follow these steps:
- Create a rpt_Index mergefield using our add-in, or an alternate method.
- Next to the rpt_Index field, insert a blank Word field using the ctrl+F9 shortcut keys on PC (cmd+fn+F9 for Mac).
- Then, inside the new curly brackets type an equals sign followed by your desired format switch. Do not toggle this field closed.
Your line should look something like this:
{ = \*Ordinal } «rpt_index»
- Highlight the other rpt_Index mergefield and drag it into the open mergefield, dropping it between the equals sign and the back slash.
Your open field should now look something like this:
{ = «rpt_index» \*Ordinal }
- Right click on the field and select ‘Update Field’
Your closed field should now look like this:
!Syntax Error, «
Don’t worry, this is expected! The error occurs because Word won’t recognise the nested rpt_Index field as a number until the document is assembled. When the document is assembled, the number will be pulled through and the equals sign will let the outer field treat that number as an integer rather than a string. This will then allow the switch to format the number, and (in our example) each row in our repeat table will have 1st, 2nd, 3rd, etc, inserted in their matching rows.
Notes:
- To have the repeat index return ‘First, Second, Third, (etc)’ instead of ‘first, second, third, (etc)’, you can use these switches together \*OrdText \*FirstCap.
- The \numbertext switch (which returns 'one, two, three...') can be implemented on a rpt_Index mergefield directly, without having to resort to this method.
If you have any trouble implementing format switches on rpt_Index fields, you can submit a request at the top of this page.
Comments
0 comments
Article is closed for comments.