Solved

Sort AttributePivoter Output

  • 7 December 2017
  • 2 replies
  • 1 view

Badge

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.

icon

Best answer by takashi 8 December 2017, 11:05

View original

2 replies

Userlevel 2
Badge +17

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

Badge

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.

 

Reply