LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

BUG: 1D Array Sort is not sorting Array of Classes and Array of Clusters contain Classes

Solved!
Go to solution

I vote that we either implement an overrideable "sort value" method for all classes (default empty string) or we simply ignore classes when sorting.

 

Having LV peek at the private data behind the scenes makes me a bit queasy.  This could be manipulated to find out class data contents..... 

 

Just my 2c.

 

Shane

Message 11 of 23
(1,976 Views)
I don't have a problem with the security issue, really, but I still maintain that this is meaningless. To illustrate, take Ben's example, but simplify it - suppose we have just one class with no elements in its cluster, how do you sort it?

___________________
Try to take over the world!
0 Kudos
Message 12 of 23
(1,960 Views)
The screenshot in the initial post illustrates why this use case isn't meaningless.  The user has some class data bundled with a numeric and a string.  He's using the numerics and the strings as keys to sort the class data.  He's probably going to unbundle the sorted classes after this operation.  I do this kind of thing all the time, I just haven't needed to with LV Class data as the data I need to sort by keys.  But I might someday.
Message 13 of 23
(1,948 Views)

I see. You're talking about the middle image in the original post.

 

I can see why you would want that to work, but it should pointed out that the logic for breaking the wire in the rightmost image applies in the center image as well. The fact that the class is third in order and will probably not be used for sorting does not mean that it will NEVER be used for sorting. I would say that IF this was changed, then classes should have no effect on the sort and should be returned in the same order they were in the original array.


___________________
Try to take over the world!
0 Kudos
Message 14 of 23
(1,942 Views)

Sounds good to me...just treat the LV Classes like they are all the same value, for the purposes of sorting.  Anyway, I included a link to this thread in the CAR, so these ideas should be visible to the eventual CAR fixer.

0 Kudos
Message 15 of 23
(1,932 Views)

Yup, ignore the classes when sorting as I said previously.

 

I don't think anything else is really viable.

 

Shane.

0 Kudos
Message 16 of 23
(1,927 Views)
Just be aware that if you do that, NI will probably get support calls with a title very similar to the current thread: "BUG: 1D Array Sort is not sorting Array of Classes - I have only a numeric in my class cluster, but when I try to sort an array of classes, nothing happens".

___________________
Try to take over the world!
0 Kudos
Message 17 of 23
(1,908 Views)

Well that's a goot time to teach the user about the meaning of private data and encapsulation and why it's NOT a bug.

 

Shane.

0 Kudos
Message 18 of 23
(1,899 Views)

Something to that effect should be added to the Sort documentation when this issue is resolved.

 

Lynn 

0 Kudos
Message 19 of 23
(1,877 Views)

Intaris wrote:

Well that's a goot time to teach the user about the meaning of private data and encapsulation and why it's NOT a bug.


This has less to do with encapsulation and more with the class-is-a-data-type concept. To sort any data type, you need some sort of logic and the problem is compounded when you need to sort "non-matching" data types.


___________________
Try to take over the world!
0 Kudos
Message 20 of 23
(1,860 Views)