Question

Attribute Accumulator Skips First Group

  • 7 November 2013
  • 3 replies
  • 2 views

Hello,

 

I am using attribute accumulator to group features and I need to use the "Input is Ordered By Group" option.  I have a list such as this:

 

 

1

 

1

 

4

 

4

 

4

 

2

 

3

 

4

 

4

 

1

 

1

 

1

 

 

and I want the results to be the following:

 

1

 

4

 

2

 

3

 

4

 

1

 

 

where it maintains the order as it groups, and the 1 and 4 appear twice in their correct place in line.  However, when I use this tool what I get is:

 

4

 

2

 

3

 

4

 

1

 

 

Notice that it skips the first group.  It found the 4 twice and placed them correctly, but the first 1 was skipped.

 

 

Am I doing something wrong?

 

 

thanks,

 

Kristi

3 replies

Userlevel 4
Hi,

 

 

I suspect that the AttributeAccumulator wasn't developed with that scenario in mind.

 

 

My suggestion would be to first make sure that your values are unique by group before you pass them through the AttributeAccumulator. Example:

 

 

1-1

 

1-1

 

1-4

 

1-4

 

1-4

 

1-2

 

1-3

 

1-4

 

1-4

 

2-1

 

2-1

 

2-1

 

 

If your list of group IDs is identified by the attribute called "ID", you can first send all your features through a Counter where you set "Counter name" to "ID". You can then concatenate the Counter value with ID, such that

 

 

NEW_ID = @Value(_counter)-@Value(ID)

 

 

You can then pass the features to the AttributeAccumulator with NEW_ID in the Group By-clause, and with "Input is ordered by group" to NO.

 

 

David
Userlevel 2
Badge +17
Hi Kristi,

 

 

I couldn't reproduce the same result of yours, I got the expected result. i.e. 1 4 2 3 4 1. The AttributeAccumulator parameter settings are:

 

Group By: <the attribute holding 1,1, 4,4,...>

 

Input is Ordered by Group: Yes

 

 

Is there difference from your setting?

 

Takashi
Thanks for the reply guys.  I managed to make it work correctly, but I'm not exactly sure what I did different.  I suspect that it is related to the order that I specified the values for grouping.  The example I gave is a simplified version of my real-life situation, and I am actually having to group on 3 columns.  When I changed the order of the group, there were no longer any missing results.  Logically, I am still trying to wrap my head around it, but at least I have it working now.

 

thanks again.

 

Kristi

Reply