# sorted/unsorted data array selection

**URL:** https://discourse.paraview.org/t/sorted-unsorted-data-array-selection/1055
**Category:** ParaView Support
**Created:** [December 17, 2018, 8:02pm UTC](https://discourse.paraview.org/t/sorted-unsorted-data-array-selection/1055 "2018-12-17T20:02:07Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![olesenm](https://discourse.paraview.org/user_avatar/discourse.paraview.org/olesenm/32/17416_2.png) [@olesenm](https://discourse.paraview.org/u/olesenm)
#### Post date: [December 17, 2018, 8:02pm UTC](https://discourse.paraview.org/t/sorted-unsorted-data-array-selection/1055/1 "2018-12-17T20:02:07Z")

</div>

In my plugin I’ve been using the following type of logic

```auto
void addNames(vtkDataArraySelection* select)
{
    select->AddArray("internal");
   ...
}

```

When presented with these values in ParaView (5.6), the order is sorted. In previous versions, the order corresponded to the insertion order.

Looked at the vtkDataArraySelection doxygen, but can’t see anything indicating sort vs non-sort. There were a few (very good) changes to vtkDataArraySelection, but nothing that would seem to affect this. Is there anything within the ParaView interface to vtkDataArraySelection that could explain this?

/mark

---

<div class="post-metadata">

### Author: ![StRuoff](https://discourse.paraview.org/user_avatar/discourse.paraview.org/struoff/32/2060_2.png) [@StRuoff](https://discourse.paraview.org/u/StRuoff)
#### Post date: [September 23, 2019, 8:24am UTC](https://discourse.paraview.org/t/sorted-unsorted-data-array-selection/1055/2 "2019-09-23T08:24:03Z")

</div>

I encountered a similar Problem with my/our custom reader. Did you figure out the cause of the behavior yet?

Regards, Stephan

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [September 23, 2019, 1:29pm UTC](https://discourse.paraview.org/t/sorted-unsorted-data-array-selection/1055/3 "2019-09-23T13:29:55Z")

</div>

Yes, ParaView sorts arrays by the name. The sorting happens in `vtkPVDataSetAttributesInformation` since it builds a map to store information about arrays.

---

<div class="post-metadata">

### Author: ![StRuoff](https://discourse.paraview.org/user_avatar/discourse.paraview.org/struoff/32/2060_2.png) [@StRuoff](https://discourse.paraview.org/u/StRuoff)
#### Post date: [October 2, 2019, 11:08am UTC](https://discourse.paraview.org/t/sorted-unsorted-data-array-selection/1055/4 "2019-10-02T11:08:33Z")

</div>

Thanks for the response.  
Is this newly introduced in Vesrion 5.6? Before that, (5.4.1, 5.5.0) there was no sorting of the Attributes-Information.

Is there any workaround to supress the behavior?

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [October 2, 2019, 11:31am UTC](https://discourse.paraview.org/t/sorted-unsorted-data-array-selection/1055/5 "2019-10-02T11:31:25Z")

</div>

> Is this newly introduced in Vesrion 5.6?

yes

> Is there any workaround to supress the behavior?

alas, no.

---

<div class="post-metadata">

### Author: ![StRuoff](https://discourse.paraview.org/user_avatar/discourse.paraview.org/struoff/32/2060_2.png) [@StRuoff](https://discourse.paraview.org/u/StRuoff)
#### Post date: [October 2, 2019, 11:38am UTC](https://discourse.paraview.org/t/sorted-unsorted-data-array-selection/1055/6 "2019-10-02T11:38:25Z")

</div>

> [@utkarsh.ayachit](#):
>
> yes

Ok, that is good to know.  
We ran into some issues with the internal sorting of the data in our custom reader, that we already resolved.

> [@utkarsh.ayachit](#):
>
> alas, no.

Previously, we sorted the data internally to show the most important variables first and the others afterwards in alphabetical order. Unfortunately, this does not seem to be possible anymore.

Do you know in which part of the code the sorting is happening? As we need to compile paraview from source (to compile our read), we would have the option to modify the part of the code to not sort the array. Would that be feasible?

---

<div class="post-metadata">

### Author: ![olesenm](https://discourse.paraview.org/user_avatar/discourse.paraview.org/olesenm/32/17416_2.png) [@olesenm](https://discourse.paraview.org/u/olesenm)
#### Post date: [October 2, 2019, 11:46am UTC](https://discourse.paraview.org/t/sorted-unsorted-data-array-selection/1055/7 "2019-10-02T11:46:38Z")

</div>

I also tried different things, but to no avail.

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [October 2, 2019, 11:59am UTC](https://discourse.paraview.org/t/sorted-unsorted-data-array-selection/1055/8 "2019-10-02T11:59:24Z")

</div>

> [@StRuoff](#):
>
> Do you know in which part of the code the sorting is happening?

As mentioned earlier, `vtkPVDataSetAttributesInformation` is the key. It’s using a map which sorts the arrays by name.
