Skip to main content
Solved

Sort AttributePivoter Output

  • December 7, 2017
  • 2 replies
  • 27 views

Forum|alt.badge.img

Hello...I would like to sort the output of the Attributepivoter. Is this possible? For example, one of the group by rows is month and I want to sort this output based on the calendar year months (Jan. to December). Thanks.

Best answer by takashi

Hi @aviveiro, if you create another attribute that stores a date string (e.g. April/01/2017) containing the MONTH_NFI value, you can use the DateTimeConverter to convert it to a number 1 - 12 representing the order of the month in a year (e.g. 4). You can then sort the features with the Sorter.

DateTimeConverter Setting Example

  • Input Format: %B/%d/%Y
  • Output Format: %N

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.

2 replies

takashi
Celebrity
  • 7843 replies
  • Best Answer
  • December 8, 2017

Hi @aviveiro, if you create another attribute that stores a date string (e.g. April/01/2017) containing the MONTH_NFI value, you can use the DateTimeConverter to convert it to a number 1 - 12 representing the order of the month in a year (e.g. 4). You can then sort the features with the Sorter.

DateTimeConverter Setting Example

  • Input Format: %B/%d/%Y
  • Output Format: %N


Forum|alt.badge.img
  • Author
  • 16 replies
  • December 8, 2017

Hi @aviveiro, if you create another attribute that stores a date string (e.g. April/01/2017) containing the MONTH_NFI value, you can use the DateTimeConverter to convert it to a number 1 - 12 representing the order of the month in a year (e.g. 4). You can then sort the features with the Sorter.

DateTimeConverter Setting Example

  • Input Format: %B/%d/%Y
  • Output Format: %N

Hi @takashi. Thank you for your response. I did as you suggested, however, found that sorting on the new numeric date field representing month (e.g. 5) didn't work because the field being used in the AttributePivoter was the month name (e.g. May). I checked the data and it was sorted properly from lowest month (4) to highest (9); however, that had no impact on the AttributePivoter output. Your response got me on the right track though, as I used the DateTimeConverter to output both the digit month (%N) and month name (%B), i.e., %N - %B. This resulted in values such as 4 - April, 5 - May, etc. in the new field that when sorted were properly reflected in the AttributePivoter output. Thanks again.