LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sorting Constants inside cluster

hello everyone

i have a lot of constants inside a constant cluster

i have tried this :

https://forums.ni.com/t5/LabVIEW/Sort-elements-in-a-cluster-in-alphabetic-order/td-p/3649743

but the problem i couldn't find out where to get this cyan, and if it works the problem i have every time to convert the constant cluster to control to convert the names then back to constant, anyway when it works also good

thanks very much

0 Kudos
Message 1 of 13
(3,753 Views)

Hi MJDGH,

 

to sort cluster elements alphabetically by their label they need a label!

To create a cluster with nice labels I recommend to create a typedefinition of your cluster (with all elements having a descriptive label).

Then just drop that typedef onto your block diagram to create a cluster constant with elements having nice labels.

 

What is all this good for? Why do you need to sort cluster elements programmatically?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 13
(3,747 Views)

you need to create type-def cluster to make it work. right click on the cluster control, select make type-def and save the control. Use the saved control in the solution you found on the other thread.

bp
0 Kudos
Message 3 of 13
(3,744 Views)

sure i have a label for each variable inside the cluster but the problem is i am using these names in many places in the program

its not possible now to add more than one cluster and i have a lot of variables i want to access them faster when they are by alphabetical order.

if i made the constant as type def then how to order these inside it ?

0 Kudos
Message 4 of 13
(3,732 Views)

Hi MJDGH,

 

when you want to access "variables" by their name I recommend to use VariantAttributes (inside a FGV)!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 13
(3,723 Views)

can someone tell me how to get this element inside the link where to get this vi !

0 Kudos
Message 6 of 13
(3,718 Views)

Hi MJDGH,

 

what is "this element"?

(Are you talking about my link? Darren talks about VariantAttributes…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 13
(3,709 Views)

Hi MJDGH,

You can find the element in 'vi script' that are not visible by default. To activate it you click on : Tools, options, Vi server, Vi scripts and you check 'Show function, property ...'. You should now find it in your LabVIEW.

Or can simply use the fact that your link show a snippet, which means that you can drag it in your code to directly get the whole code shown in the picture.

Message 8 of 13
(3,704 Views)

hi mjdgh

are talking about the subvi in your link, that seems like third party toolkit. you can also create yourself one, i have attached a sample .

 

edit:attachment

bp
0 Kudos
Message 9 of 13
(3,701 Views)

Hello 

can someone please explain how to set the VI in edit mode

because i got this error:

LabVIEW: (Hex 0x431) This property is writable only when the VI is in edit mode, or this method is available only when the VI is in edit mode.

Thanks

0 Kudos
Message 10 of 13
(3,679 Views)