LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to _permanently_ sort .lvlib/.lvclass contents by Type?

Highlighted

In the LabVIEW Project explorer, we can right-click -> Arrange By (Name, Type, Path, Custom). However, I cannot seem to save my choice. When I close and re-open my project, it reverts to Arrange By Name. Tested on LabVIEW 2017 SP1.

 

In contrast, Targets (e.g. "My Computer") and Virtual Folders outside .lvlib/.lvclass files can be permanently sorted.

 

Am I missing something?

Certified LabVIEW Developer

0 Kudos
Message 1 of 7
(733 Views)
Highlighted

I believe the sorting is saved in the lvproj file (tag "NI.SortType"). The lvproj file only refers to container items such as libraries and its derivative classes, not to their contents. Libraries don't normally have a "NI.SortType" tag so any sorting you specify doesn't get saved - this would require the lvlib/lvclass to also be saved to recall your setting.

 

I haven't tried manually adding this tag to a library file to see if that permanently saves the sorting. You could try it and find out.

Message 2 of 7
(694 Views)
Highlighted

Thanks for your insight, tyk007.

 

LabVIEW does write "NI.SortType" to .lvlib/.lvclass files, but seems to ignore this tag when loading the file.

 

Here's my experiment:

 

  1. Created MyLib.lvlib
  2. Added some files, e.g. "1.ctl", "2.vi", "3.ctl"
  3. Right-clicked MyLib.lvlib and selected "Arrange By..." -> "Type"
  4. Right-clicked MyLib.lvlib and selected "Save" -> "Save"
  5. Closed MyLib.lvlib
  6. Opened MyLib.lvlib
  7. (Didn't make any changes at all)
  8. Right-clicked MyLib.lvlib and selected "Save" -> "Save"

 

Observations:

  • After Step #2, the items were sorted 1-2-3
  • After Step #3, the items were sorted 1-3-2
  • After Step #4, MyLib.lvlib contained the line <Property Name="NI.SortType" Type="Int">1</Property>
  • After Step #6, the items were sorted 1-2-3
  • After Step #8, MyLib.lvlib contained the line <Property Name="NI.SortType" Type="Int">0</Property>

Certified LabVIEW Developer

0 Kudos
Message 3 of 7
(680 Views)
Highlighted

Hello!


I'm seeing the same behavior in LabVIEW 2016 and 2017 SP1 for the Arrange By -> Type and that it seems to be going back to arranging by name. However, this is expected behavior. See the LabVIEW Help: "If you sort a project library by Type or by Path, LabVIEW automatically re-sorts the project library by Name the next time you open the project library."

Sorting Items in a Project : http://zone.ni.com/reference/en-XX/help/371361P-01/lvhowto/organizing_items_project/

It does preserve the arrangement for Arrange By -> Custom. Though perhaps not the workflow you'd like, if it's important that your VIs are sorted by type/in a certain way in your library, you can arrange it by the Custom sorting. 

R Dahlman

Message 4 of 7
(668 Views)
Highlighted

@DahlmanR wrote:

However, this is expected behavior. See the LabVIEW Help: "If you sort a project library by Type or by Path, LabVIEW automatically re-sorts the project library by Name the next time you open the project library."


And who thought that was a good idea?  I would really like to see the data that says this behavior is desirable.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Message 5 of 7
(661 Views)
Highlighted

Hello R Dahlman, thank you for linking us to the relevant part of the official documentation!

 

I'm with @crossrulz though: The documented behaviour is unintuitive and does not benefit the user in any way (as far as I can see). Could you please check with LabVIEW R&D what their rationale was? Also, are they willing to change this behaviour?

Certified LabVIEW Developer

0 Kudos
Message 6 of 7
(650 Views)
Highlighted

Since it's not a bug and is instead different functionality, it will be best to post on the LabVIEW Idea Exchange with your thoughts! Our R&D teams actively monitor the Idea Exchange for new feature requests and the more wanted a feature, the more likely they'll take a look at it. 

Since there's a couple people active on here as well, you can post your LabVIEW Idea Exchange post link here, and people that find this post can go Kudo or comment on your Idea Exchange post to get it visibility. 

LabVIEW Idea Exchange : https://forums.ni.com/t5/LabVIEW-Idea-Exchange/idb-p/labviewideas

R Dahlman

0 Kudos
Message 7 of 7
(633 Views)