# LabVIEW

cancel
Showing results for
Did you mean:

## When deleting cases in a consecutively numbered CASE structure can one shift down the higher case numbers in order to make all the cases again consecutive?

An example: 1) Created a case that had 100 numerical cases all in consecutive order going from "1 .. 100";
2) Found that I need to delete 10 consecutive cases from 41 to 50;
3) After completing this operation I find that I now have: an 'IF' structure that has cases numbered from:
"1 .. 40, 51 .. 100";
4) I would like to colapse this from "Item 3" to the following: "1 .. 90"; with all 90 cases in monotonic,
consecutive order, with NO holes;
5) I know that this can be done, but unfortunently, rather slowly and painfully, using the following process:
a) Delete the 10 consecutive cases that one no longer needs,
b) Then add a case after case 40, (which is blank of course), then again after the new case 41, and
continue this till you have created case 50; all in consecutive order, (for these 10 new blank cases),
c) Now go to case 51 and at the top middle of this case, right click and get a drop down menu that gives
you  a number of options; one of them being, (paraphrased): "~Exchange this case block diagram
with the case number that you now choose",
d) So starting with case 51, exchange it's block diagram with case 41, then exchange case 52 with case
42; now continue to iterate until you finally exchange case 60 with the blank case 50,
e) Now do 'd' four (4) more times for a total of 50 exchanges, (wow, thats exhausting to even think
6) Your, now done with this operation that has at least 50 exchanges and a number of other operations. If
you have done everything exactly correctly then you now have an 'IF' structure that has 90 cases
numbered from 1 to 90 in monotonic consecutive order, (with no holes),
END EXAMPLE

My assumption is that LabVIEW must have a better and easier approach to doing this above operation. I haven't seen
a better approach after a few minutes scan, so I know that I MUST be missing something. My question is what am I missing
and how can I do the above operation easier and with a lot less time???????

Message 1 of 5
(895 Views)

## Re: When deleting cases in a consecutively numbered CASE structure can one shift down the higher case numbers in order to make all the cases again consecutive?

A case structure with 100 cases seems like a programmers nightmare.

So far you are only telling us what case numbers you want, but you're not telling us what is INSIDE these cases. Do all cases have different code?

It seems that the new case 41 need to contain the code of the old case 51 and so on. I would think easiest would be to delete cases 41..50 then simply rename the higher cases. For example, go to case 51 and change the 51 to 41, then 52 to 42, etc. (no need to add blank cases then swap, etc.)

In any "case" (no pun intended), it seems to me that maybe you are approaching that entire code structure the wrong way. Can you tell us a bit more about your program and what is is supposed to do?

I

LabVIEW Champion Do more with less code and in less time
Message 2 of 5
(886 Views)

## Re: When deleting cases in a consecutively numbered CASE structure can one shift down the higher case numbers in order to make all the cases again consecutive?

5) I know that this can be done, but unfortunently, rather slowly and painfully, using the following process:
a) Delete the 10 consecutive cases that one no longer needs,
b) Then add a case after case 40, (which is blank of course), then again after the new case 41, and
continue this till you have created case 50; all in consecutive order, (for these 10 new blank cases),
c) Now go to case 51 and at the top middle of this case, right click and get a drop down menu that gives
you  a number of options; one of them being, (paraphrased): "~Exchange this case block diagram
with the case number that you now choose",
d) So starting with case 51, exchange it's block diagram with case 41, then exchange case 52 with case
42; now continue to iterate until you finally exchange case 60 with the blank case 50,
e) Now do 'd' four (4) more times for a total of 50 exchanges, (wow, thats exhausting to even think

That's an awful amount of effort wasted,  I must say!

All you have to do is click  on value '51' in case selector label and change it to '41'
Repeat fhis for all subsequent cases

Hope this helps,

regards,
Dev

Message 3 of 5
(880 Views)

## Re: When deleting cases in a consecutively numbered CASE structure can one shift down the higher case numbers in order to make all the cases again consecutive?

Christian, hope your recuperation is complete

altenbach: In any "case" (no pun intended), it seems to me that maybe you are approaching that entire code structure the wrong way. Can you tell us a bit more about your program and what is is supposed to do?

I would second that
Message 4 of 5
(878 Views)

## Re: When deleting cases in a consecutively numbered CASE structure can one shift down the higher case numbers in order to make all the cases again consecutive?

Thank you very much for your concise comments and of course I used your approach this morning ... very simple &

VERY NICE!!! I was making a simple task much harder than it should have been. Hard to believe that I've been doing

this for almost 8 years now. Thanks Again!  - Aerospacer

Actually this structure works quite well for my needs, (in which I'm modifying an existing module with this structure

contained within it, ~ 35% modified). I've got 6 clusters each with 8 to 18 objects within them. These objects represent PCB

cards or instruments which can be repeated as necessary. But these objects are actually represented as True/False

switchs. Therefore if an operator toggles a switch, (object), then the PCB card or instrument which has a functional

representation, (sub-VI), is then called and the operator can make changes as needed. I use: 1) cluster to array.nivi for

all six clusters; 2) concatenate arrays.nivi then use the search.nivi with a 'True' to find the operator actuated instrument,

(capability), that that operator wishes to make changes too. NOTE: the final array size is between 40 to 80, I just used

100 because it's easy to work with.

Again, Thanks and Regards,  Aerospacer

Message 5 of 5
(843 Views)