Skip to main content
Solved

How to get the row number (such as 1, 2, 3...) of each row in a data set?

  • March 3, 2016
  • 3 replies
  • 642 views

bo
Contributor
Forum|alt.badge.img+10
  • Contributor

Thought this would be easy, but we are struggling to assign a newly created attribute with row numbers that indicate its sequence in the set.

Best answer by erik_jan

How about the Counter transformer? Could you use that?

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

erik_jan
Contributor
Forum|alt.badge.img+23
  • Contributor
  • Best Answer
  • March 3, 2016

How about the Counter transformer? Could you use that?


bo
Contributor
Forum|alt.badge.img+10
  • Author
  • Contributor
  • March 3, 2016

How about the Counter transformer? Could you use that?

Thank you, @erik_jan!


takashi
Celebrity
  • March 3, 2016

Hi @bo, I agree that the Counter is a generic solution. Alternatively, in some formats, you can also use a predefined format attribute that stores the row number. e.g. "csv_line_number" for CSV. Check the Format Attributes tab of the reader feature type properties dialog.