LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CASE structure limits - dynamic? (once more)

Hello

I am not sure I have explained myself clearly at the first time, therefore I enclose pictures.

There are two integers and one CASE structure.
I want to have the CASE limits dependent "dynamically" (could be changed during program run) on Numeric 2.

I know there is always way around, but I am interested in this solution.

best regards
PP
0 Kudos
Message 1 of 13
(4,002 Views)
Hi Pawel,

That simply can not be done at run time.

Sorry to disapoint but that how it is.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 13
(4,002 Views)
Hi Ben
This is also good information, because the worst is the lack of information.
Now when I know it is not possible I will not think about it as alternative possibility, therfore I can concentrate on something else.
Thank you
regards
Pawel
0 Kudos
Message 3 of 13
(4,002 Views)
As Ben says, you cannot do exactly what you want to do, eventhough i can see why it could be useful. As you say, there is always a way round, and what i would do is have a CASE within a CASE, but even then this is still limited - and time consuming!

Maybe you will hear from NI about considering it in their next version of LV?

Kim
0 Kudos
Message 4 of 13
(4,002 Views)
Hi Kim
Is this possible to suggest it to Ni? How?

kind regards
Pawel
0 Kudos
Message 5 of 13
(4,002 Views)
Well, with any luck they would have already read your problem and noted it down. But to be sure you can post a message on their product feedback page at:

https://sine.ni.com/apps/we/nicc.call_me?p_country=&p_lang_id=US&p_form_id=58

Best of luck!

Kim
0 Kudos
Message 6 of 13
(4,002 Views)
Thank you Kim, I'll do so.

regards
Pawel
0 Kudos
Message 7 of 13
(4,002 Views)
Changing the cases that exist in code during runtime is impossible! There is no need, nor any possible way to do this.
0 Kudos
Message 8 of 13
(3,851 Views)
Let me see if I understand your ACTUAL question here (you have asked too specific a question.):

You would like to make make a comparison based on limits obtained through another comparison? Please let me know if I have understood your problem.

If in fact you want to have "dynamic limits", then the method you suggested (dynamic code) is not the answer, but there is in fact a way to do this. All you do is create logic for the limits used in your logic. This is another 'dimension' or level, as they are commonly called, of logic in your program.

Your program itself cannot be dynamic, that is, you cannot have code that changes based on values of certain variables. But, you can create code that affects the same results, you just have to plan ahead, and
create the logic.

Allow me to illustrate:

Let's say you want to generate a boolean of True if variable X is > 2, and false otherwise. However; if variable Y is < 0, you want to compare X to 5 instead of 2. All you do is compare Y first, then, dependent upon the output of this comparison, you will either compare X to 2, or to 5.

Please let me know if this answers your actual question.
0 Kudos
Message 9 of 13
(3,851 Views)
Hello Labviewguru
Thanks for the answer.
I always say there is way around the problem, and I was strictly interested in the question I asked and explained on
picture.
You are right, there is probably plenty of other solution, but I found this as a nice solution.
You have given solution for simple case, but notice that if you have to compare more than one time, than the CASE
structure would be a great of help.
I will give you another example similar to C code. the variable being tested is X, the dynamic limits are given by
variables k,k,m:

switch X
case 1..k
action1();
case k..l
action2();
case l..m
action3();
.
.
.
case other
action_last();

the variables k, l, m c
an change dynamically in the program.

Once more I want to stress that I now I can do it other way. What I wanted to know, and only this, was if the CASE
structure has the possibility to support the dynamic limit changes by e.g. property node or something like this.

kind regards
Pawel
0 Kudos
Message 10 of 13
(3,851 Views)