Question
Rows in a table need to be enumerated by order, but the table does not contain a column with a row's number. Is there a way to achieve this?
Answer
- Add a new field in the table. In the screenshot below it is named Item Number:
- In the properties of the newly created field, create a script rule. Make sure the field is not read-only in the script properties:
- The code of the rule is as follows:
for (int i = 0; i < Context.Field("Invoice_Table").Items.Count; i++)
{
Context.Field("ItemNumber").Items[i].Text = (i+1).ToString();
}
Comments
0 comments
Please sign in to leave a comment.