LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

define number of case structure cases

Solved!
Go to solution

Is there a quick way to define say 200 cases in a case structure without having to manually add another case after or before?

Regards,

0 Kudos
Message 1 of 29
(2,953 Views)
Solution
Accepted by topic author Grant_C

Hi Grant,

 

whoever needs 200+ cases in one structure would use a typedef enum, connect that to the selector input and select "create case for every item"...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 29
(2,951 Views)

so i put down a enum on the block diagram then make it a type def but it still only gives a few cases and i dont see another way of defining the number?

0 Kudos
Message 3 of 29
(2,946 Views)

Hi Grant,

 

well, if you would define that enum with all those 200+ cases before connecting it to the case structure you would also have the option to create 200+ cases in that structure with just one (right-)click...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 29
(2,944 Views)

I have attached my code so you can see my purpose.  I have about 200 clusters of controls/indicators/tab pages that i want to feed down into a report generation subvi.  When creating my Excel and Word reports, i need to extract the results and also change tab page so that i can take screenshots then save to the report.  I have been informed this is the best way to proceed.

Regards,

0 Kudos
Message 5 of 29
(2,943 Views)

Hi GerdW, when i open the type def enum, i still have to create each enum manually 200 times.  I tried to create an array of 200 numerics and feed that in into the case selector but i got an error line.

0 Kudos
Message 6 of 29
(2,932 Views)

I really don't understand what you are trying to do. When someone says they need to deal with 200 cases, I say you're probably doing it wrong. If you could provide a better example of what you are trying to do, then perhaps a better suggestion can be provided.

 

In terms of some of your questions:

  • As Gerd noted, if you connect an enum to a case structure, you can have it generate the (empty) case items for each enumeration value.
  • If you need to duplicate the case items for each enum value, then you need to use scripting.
  • You can convert an array of string to an enum. See this idea, which includes some examples as alternative solutions: http://forums.ni.com/t5/LabVIEW-Idea-Exchange/convert-String-Array-to-Enum/idi-p/1025934
  • You cannot connect an array to a case structure. That makes no sense.
Message 7 of 29
(2,924 Views)

At some point you are going to have to enter the names of all those items. After dropping the enum on the front panel, pop up on the control and select Edit Items.  This will get you a dialog box in which you can type the names of the items.  This can be much faster than using the mouse to create item after one at a tiem from the front panel.

 

Do the clusters you want to find have unique names? If so, perhaps getting an array of references to the clusters and looping through the array would allow you to extract the data you want without needing a case for each one.  I would envision 2-5 cases, depending on how many different control types you have.

 

Lynn

Message 8 of 29
(2,921 Views)

Hi , my attachment shows what i am trying to achieve with only 4 of my 200 cluster references.  In order to save block diagram space and to have only one cluser line fedding down into my report generation subvi, i am using the reference constants as a common then on each of the 200 cases, i will have a different reference feeding into the appropriate bundle by name in order to create my cluster of references.  In the subvi, i can then use any of the information when required at stages throughout the report generation.

0 Kudos
Message 9 of 29
(2,920 Views)

I have attached a vi that includes the various data types i am trying to reference into my report generation sub vi

0 Kudos
Message 10 of 29
(2,903 Views)