LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

QD: Alphabetize Case Structure Cases

I am attaching something I wrote up today. I think this is a long overdue feature (heck, maybe it's in LabVIEW already and I don't know about it.) Furthermore, I'd be willing to bet it's in the JKI right-click framework already. But, anyways, hopefully some people can find this useful. This QD shortcut will alphabetize all cases in your case structure. Let me know if there are any scenarios where it's not working as expected. I haven't done much testing with it.

Message 1 of 23
(4,956 Views)

You're right, the CaseSelect JKI RCF plugin has this (among other things).

 

CaseSelectAlphaSort.PNG

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 2 of 23
(4,935 Views)

wah wahhhhhhhhhh Smiley Sad

0 Kudos
Message 3 of 23
(4,919 Views)

 


@for(imstuck) wrote:

(heck, maybe it's in LabVIEW already and I don't know about it.)


 

With three or more Cases (or Events or Subdiagrams), Right-Click -> Rearrange Cases -> Sort (Button)

 

Don't be dismayed, the ability to go from "I wish LabVIEW would to this" to making it happen via QD,RCF the Tools menu, or whatever should serve you well.

Message 4 of 23
(4,911 Views)

Firing up LV10, the code looks pretty good (helps to have a nice template).  Let me help you in the marketing department instead.  You left out an important detail, your shortcut performs a case insensitive sort which I actually find to be useful.  As Ben would say, create the need, then fill it.

 

"Who in their right mind would do a simple ascii sort when you really want to alphabetize your cases?  Nobody, now with this spiffy QD shortcut you can quickly and easily do the sensible thing in just a couple of clicks."

 

Now I am starting to wonder how I got along without it.  Well done.

 

(Now just update the undo transaction name).

0 Kudos
Message 5 of 23
(4,895 Views)

@Darin.K wrote:

 

(Now just update the undo transaction name).


Thanks for pointing this out. Actually I did do this but forgot to set as default before saving. I assume this is something most people can do on their own though so I'll leave that up to you Smiley Wink

 

I also like the ability that I can hit ctrl+A to select everything and it will sort all case structures on the diagram rather than right clicking every one.

0 Kudos
Message 6 of 23
(4,877 Views)

 


@for(imstuck) wrote:

 

I also like the ability that I can hit ctrl+A to select everything and it will sort all case structures on the diagram rather than right clicking every one.


 

Careful with that move, just remember that numerical order can be different than alphabetical order, as can enum order.  What happens when you try it with True/False cases?

 

I am a little worried about your apparent fondness for String based Case Structures....  Smiley Wink

 

And a final tidbit of advice based on my experience:  Doing 98% of the work for us in no way spares you from complaints that we still have to do the remaining 2% (ie. change the transaction name).  Smiley Tongue

0 Kudos
Message 7 of 23
(4,870 Views)

Great shortcut!  I've added it to the List of Community Quick Drop Keyboard Shortcuts page.

0 Kudos
Message 8 of 23
(4,856 Views)

@Darin.K wrote:

 

 

Careful with that move, just remember that numerical order can be different than alphabetical order, as can enum order.  What happens when you try it with True/False cases?

 

I am a little worried about your apparent fondness for String based Case Structures....  Smiley Wink

 

And a final tidbit of advice based on my experience:  Doing 98% of the work for us in no way spares you from complaints that we still have to do the remaining 2% (ie. change the transaction name).  Smiley Tongue


Acccctually, I never use string based for state machines, but let's not start that argument!

 

I'm a bit confused what the order has to do with it, it seems to work for string based, enum, and True/False structures. If you sort True/False it will put False first. If you use enum, it gets the enum text and sorts based on that.Can you give an example?

0 Kudos
Message 9 of 23
(4,835 Views)

I do not doubt that it 'alphabetizes' properly, only that I find the natural ordering for enums to be enum order and for numbers to be numerical order.   That is why I would be hesitant to Ctrl-a Ctrl-space Ctrl-whatever.   Do you actually get False then True for a boolean case, I do not think you can do that by hand?

 

Are you going to extend to Event Structures?

 

0 Kudos
Message 10 of 23
(4,828 Views)