Display the current row number of a table

Top Previous Topic Next Topic  Print this topic

Overview:

Most of the times it is very useful to display the current row number in a table.

 

Solution:

This can be done using a predefined function: position() which returns the position of the node in a nodes list.

 

For a better understanding, an example is provided below.

 

1. A new column must be inserted in the table that this option will be applied to. For this example, the cdcatalog.xml data source was considered and the repeating table was created by dragging and dropping ns:cd node from the Data Source dialog bar and selecting Repeating Table.

 

2. The current position can be inserted anywhere in the table but usually it is used a column located in the left side of the table.

 

3. After the cursor has been placed in the new column, the Field button located in the Dynamic Content group under the Insert tab must be selected.

The Edit Expression dialog will be displayed.

 

4. From the list of functions the one needed for this example is position() from Nod-Set functions.

 

current_position3

 

5. The pictures below display the result of these actions:

 

Design View:

 

current_position

 

PDF result:

 

current_position2