Programmat​ically change case structure range

I think I already know the answer to this, but I'm going to ask anyway. In the attached image, is it possible to programmatically change the range of numbers the case uses?
Tay
Solved!
Go to Solution.
Attachments:
case structure.png ‏3 KB

To use a property node on a case selector, you need to have a reference to it.  There are several ways to open the reference, depending on where the object you want to reference is located.
EASY - If the case selector is not inside another structure and has a unique name, use Open VI Object Reference with the name of the case selector as the input.  The owner is the block diagram reference and the object class is a case selector.
FAIRLY EASY - If the case selector is inside another structure or structures and all structures and the case selector have names unique to their diagrams, open the structures from outside to inside as in case 1.  After you open the structure reference, get a reference to the appropriate diagram and repeat until you get to the final case selector.
HARDER - Case selector has a unique name, but is buried in a container which does not.  Use the Traverse method to find all case selectors, then use the Label property of each to find the right one.
HARDEST - Case selector does not have a unique name.  Use the Traverse method to find all case selectors, then find the one you want by the frame labels.
The take-home message from this is that your life is much easier if you give your containers unique names.
This account is no longer active. Contact ShadesOfGray for current posts and information.

Similar Messages

  • Case Structure Ranges Determined From Input Variables

    Hello, 
             I am trying to write a vi that will read in a random number, and depending on how close or far away from the intial given value it is, it will do something different to the value using a case structure.(Not positive this is the best way)
    Ideally I would like to somehow incorrporate the value that is on the front panel from the user, into the different ranges so they are not set. Is there any way instead of using [ ..10, 11..15, 15.. ] I could use the [..(indicator - 5), (indicator-4)..(indicator +4), (indicator +5)..] as my three different cases? Or is that just crazy and I should be trying to use a different type of structure maybe? 
    Thanks in advance for the help, 
    KT

    What if you would subtract the reference value before wiring to the case structure?
    (assuming you are dealing with integers)
    LabVIEW Champion . Do more with less code and in less time .

  • Programmat​ically changing the TCP/IP address of Windows Vista / 7 / 8

    Hi there!
    I'm pretty new to LabVIEW (started 2 months ago) and still have a long way ahead of me, so please forgive me if anything that I ask is too basic.
    I'm trying to change the IP properties of the PC via LabVIEW for some bigger software I'm working on.
    I can easily do it in Windows XP using the System Exec function to call cmd.exe and then use netsh commands, as previously explained for example here:
    https://forums.ni.com/t5/LabVIEW/Programmatically-​changing-the-IP-address-of-Win-XP/m-p/410533/highl​...
    https://forums.ni.com/t5/LabVIEW/Change-IP-number-​and-Subnet-mask-with-LabView/m-p/407536/highlight/​...
    http://forums.ni.com/t5/LabVIEW/How-to-change-the-​TCP-IP-settings-of-the-LAN-connection-from-LV/m-p/​...
    http://forums.ni.com/t5/LabVIEW/Change-the-compute​r-IP-address-in-LabVIEW/m-p/167481?query.id=108803​... ...
    But then, since I want to run my software in Windows 7 (& by extension to any Windows OS), I have a problem: netsh asks for elevated rights.
    So, the next problem is: how do I run cmd.exe (or any other programm?, by extension) as administrator (from LabVIEW)?. Note that I'm using an account with admin rights. But I would prefer not having to disable the User Account Control configuration, and I don't want to force the user to any interaction (clicking in pop-ups, or right-clicking in anything), I want it to be as automatized as possible.
    I did a bit of research and couldn't find anyway to do it, neither any command to run with cmd, so the two similar solutions that came to my mind are very rudimentary and kind of dirty:
    Use DLLs to make LabVIEW press the keys necessary to open cmd running as admin via key shortcuts (using a variation of https://decibel.ni.com/content/docs/DOC-29563 and the key shortcuts from here: http://www.howtogeek.com/howto/windows-vista/run-a​-command-as-administrator-from-the-windows-vista-r​...). Here, I open the Window menu (with LWIN), properly writes "cmd", and then uses CTRL+SHIFT+ENTER ok... but then the User Account Control appears and LabView keeps doing the commands (I want ALT+Y or LEFT & then ENTER)... without affecting to the UAC! If I make LabVIEW wait a bit and manually close the UAC I succesfully have the command prompt... but LabVIEW is still incapable of write the text that I'm giving it to him (the netsh commands). LabVIEW runs the software, but it's like the UAC & the command prompt are running in a higher? level and are not affected by LV. If I do the same over a .txt I succesfuly have the intended text. Any ideas about this?
    Create a link to cmd.exe and change the properties to "Run as administrator", then use System Exec to call the link, expecting to open a command prompt with elevated rights, and then write the netsh commands either with DLLs (that might not work according to my first solution) or using the "standard input" of System Exec? (not sure if this is possible). But then System Exec gives me an error (code 2) when trying to execute the .lnk and so the command prompt does not open. The error code stands for "Error 2 occurred at an unidentified location. Possible reason(s): LabVIEW: Memory is full." Any idea about how to solve this?
    The conclusion is that I'm stuck with two possible solutions none of them working.
    Maybe there's a more simple solution that I didn't think about?
    Solutions to these problems?
    Any different proposals?
    Thanks in advance for any tip or help!
    Note: I titled the thread as Windows Vista, 7 & 8 since I assume all of them asks for admin rights when changing IPs. In case there are other people with the same problem, altough right now I'm only using XP & 7.
    Alejandro Asensio, CLAD

    First question: Why do you have to change OS properties via a custom application? I know such requirements can exist (sigh...) but nevertheless it seems a little bit weird to me ;-)
    OK, now an idea:
    Run cmd.exe via task scheduler. Here is a how to do it: http://maximumpcguides.com/windows-vista/run-a-pro​gram-with-administrative-privileges-without-uac-pr​...

  • Programmat​ically change the modified date of a folder

    Is there a way to programmatically change the last modified date of a folder?  The OpenG file info VI doesn't seem to work for a folder.
    Jim
    LV 2013
    Solved!
    Go to Solution.

    Please don't take this as criticism.  Often users will post in multiple locations and get varying levels of help from each place they posted.  This makes for a fragmented discussion where one group of individuals aren't collaborating with a separate group of individuals who are working on the same problem.  Posting in both places is fine, but I think what helps is having a link from one post to the other, so that individuals in one group can see the discussion taking place in the other.  This helps avoiding suggesting the same solution twice, and help come up with solutions neither group has come up with yet.
    At first glance the two posts looked similar enough that I thought this would be the case where the two groups can at least see the discussion taking place elsewhere.  If the two posts aren't related at all then I apologize for providing the link between them.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • Can you programmat​ically change a picture control frame/bord​er

    In a platform neutral manner can I programmatically change a picture control frame/border
    Solved!
    Go to Solution.

    You can make it look that way using many differnt methods.
    The simplest is to make the border transparent and put a boolean behind the picture. Size the boolean so it looks like it is the border of the picture. Change the color of the boolean and you are on you way.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Programmat​ically change the IAK on the fieldpoint controller​.

    Inside a g-based program.

    Rascal,
    If you are referring to changing the IAK file programmatically on the host see the following Knowledge Base:
    http://digital.ni.com/public.nsf/websearch/AD7E2B9​7C60086B886256DDE006FBED2?OpenDocument
    Changing the item names that are downloaded on to the controller is not supported, but here is a possible solution (untested):
    1. Download the item names to your controller.
    2. FTP to the controller and then change the name of the following file: ftp:///NI-RT/SYSTEM/fpbank.ini. This is the file that holds the I/O modules names.
    3. Repeat the previous two steps until you download several different sets of item names to the controller.
    4. When you want to switch which configuration you are using just use the file I/O VIs to ch
    ange the name of the item name file to fpbank.ini.
    5. You may have to restart the controller before the new item names are valid.
    As I said this is completely untested and unsupported, but a possible solution to want it seems you want to do.
    On a side note you should try to be a little less harsh to people who are just trying to help you out.
    Ames
    Applications Engineering
    National Instruments

  • Programmat​ically change PXIe-2529 topology with NISE

    Hi !
    I have a PXIe-2529 that I control through NISE to test some products. These products require the matrix topology to be changed while I'm testing them.
    Is there any way to do this programmatically ? 
    Opening/closing NISE session might be solution (even if I would prefer not to close it), but I can't find an option string xorking to change the topology...
    Any ideas ?
    thanks !
    Solved!
    Go to Solution.

    zyl7,
    Unfortunately there is no way to change the topology on the fly with NI Switch Executive. A better method would be to have two NISE Virtual Devices, one for the 4x32 2 wire configuration, and one for the 8x16 2 wire configuration. You would close out the NISE session from VirtualDevice1, and open a session to VirtualDevice2 that references the same hardware. Of course, you would need to make sure that the external connections are connected properly, but this should change the topology for you.
    Note: Closing the NISE session for VirtualDevice1 and Opening the NISE session for VirtualDevice2 will reset the switch module and cause all previous connections to open.
    Hope that this helps!
    Frank,
    National Instruments
    Staff Software Project Engineer

  • Programmat​ically change Results Active Configurat​ion

    I'm using TestStand 2012 SP1.  I'd like to be able to configure the Active Configuration for results in the process model.  A station running our sequential model would set the Sequential Reporting configuration as the active configuaration while a station running a Batch Model would set the Batch Reporting as the active configuration.  Furthermore, if a station can do both, the application run would select the proper process model and it would then select the proper reporting configuration.
    I've got configurations setup but need to know how to set the active configuration.  I don't want this on a  per sequence basis, but rather at the process model level so it is run once and done.  This would allow for developers to modify their configuration but still have the Batch or Sequential Reporting selected depending on what they are working on.
    Thanks.

    You are right about the ModelSupport.seq version of the callback being used. You could:
    1. Modify the callback in ModelSupport.seq (or the call to it). You could determine what model you are being called from with something like:
         Find(RunState.Execution.GetModelSequenceFile().Pat​h, "SequentialModel.seq", 0, True) != -1
    2. Use StationCallbacks.seq. When I tested this, I was having trouble getting it to call the callback, but when I restarted the editor, it started working. Not sure if you need to restart after editing the stationcallbacks file (you shouldn't need to), but try that if you have trouble and please let me know if that was the issue.
    3. As the first step in each model, you could load the configuration file, change the activeConfiguration, and resave the file, but (1) or (2) seem a bit less heavy handed to me.

  • Cases programmat​ically from xml in case structure

    I want the cases in my case structure to be updated programmatically from an xml file. Is this possible?

    You can, but don't forget what Felix wrote - a VI can't programmatically change itself.  You'll need a separate VI to modify the Case Structure you're working with.
    This example gets a reference to the target VI, traverses for all Case Structures, selects the target by its label, adds a frame and gives it a Selector Label.  You'll need to modify the last three VI Server nodes to accommodate your particular application.
    Good luck.
    <edit> take a look at my CaseSelect JKI RCF Plugin, it contains a bunch of Case Structure manipulation code.</edit>
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
    Attachments:
    contains case structure.vi ‏9 KB
    controls case structure.vi ‏12 KB

  • How can I programmatically change the voltage range settings in a DAQ Assistant

    Hi,
    First post here.  
    I need to be able to change the voltage range properties of a daqmx DAQ Assistant based on user input.  My hardware, an SCXI-1102C does not allow changing this property on a running task, so I'd like to either set the analog input voltage range before the DAQ Assistant activates, or pause the DAQ Assistant immediately after it starts, set the values and then resume.
    I don't know how to edit the task ahead of time because the DAQ assistant creates the task when it runs, and there is no task before that.
    In the attached picture, I have a conditional section, set to run only if the while loop iteration is 0.  I take the task from the Daq assistant, send it to a stop task vi, set the property, and then send the task on to the start task vi. I can watch it run with the debug light on, and everything seems to work correctly, but on the second (and all the other) iteration of the loop, I read out AI.Max and it seems like the DAQ Assistant has re set it back to 5V.  Can anyone see what is going wrong here?
    BTW, this is continuous acquisition and the code does not produce error messages when it runs.
    I did come across a similar question that someone posted here back in 2006, but his question was specifically aimed at a Labview API (VB, I think), and not an actual G solution.
    Attached are the actual vi in question and a png image of the block diagram.
    Thanks! 
    Ruby K
    Solved!
    Go to Solution.
    Attachments:
    Labview_question.PNG ‏14 KB
    Sample_AIV.vi ‏91 KB

    First, if you want to start getting beyond the basics with DAQ, you are going to have to stop using the DAQ assistant and do it with lower level DAQmx VI's.  There are hundreds of examples in the example finder.  You can even right click on the DAQ assistant and select open front panel.  That will create a subVI that you can open and see what is going on behind the scenes.  Do it.  I think you'll find the DAQ task is being recreated on each (though I'm not 100% of how the settings are established or maintained in each section of that subVI).
    The second problem is you have a bit of a race condition on iteration 0.  Those two DAQ property nodes are running at the same time.  So when you read the AI.Max, it may be happening before or after the AI.Max is set in your case structure.
    Third, make sure you wire up your error wires.

  • Case Structure Based on Changing Input Controls

    Hello. I am trying to create a control VI for a quad-copter. Right now I've managed to build a basic program that gets input from some sliders and transforms and sends it to the quad-copter motors through I2C and virtual serial port.
    The problem that I'm having is that I want to be able to control the engines either individually or in pairs, so I can achieve motion in all directions. But since I can't have multiple inputs at the same time for each engine, I think I might need a case structure. What I would like to do is have a scenario where depending on whether an input changes and how (either for an individual motor or a group), the case structure switches to that case and takes the inputs specified for that particular case. What I'm thinking is having 10 or so sliders, 1 for each engine, and then 1 each for groups like 1 & 2, 3 & 4 and 1 for all, and depending on whether they change and how, switch to the case where only those particular engines change speed.
    Can you please help me out with that? Thank you. 

    That is one way to accomplish it. I would probably use the event structure. It is not that difficult to use. It is very similar to the case structure.
    I would also caution you on comparing two floating point numbers. Due to rounding it is possible that you will subtract two values which are essentially equal but return a non-zero result. You should use the "In Range" VI and set some tolerance value which indicates the numbers are equal.
    One last item, do you want your shift registers to be unitialized? If they are unitialized they will retain the values from the last execution of this VI. You may not want that since I assume you would want your motors to be off in the initial state.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Range setting in case structure

    Hello everyone! I'm working on an engineering project where I read in a sound input and if it's on high volume, a red led connected to a MyDaq box lights up, if it's on low, the green LED lights up, and both will be off if there's no sound input. I posted a screenshot of how my vi currently looks. The problem I'm having is, I want to set the range that will be considered as the low volume, and a range considered as the high volume on my case structures. I'm not sure exactly how to do that. I currently have an "In range" function there where I set the max and min values. THe problem with this is, it outputs a dynamic data that I cannot connect to the appended array. Any help would be great. Thanks!
    Attachments:
    projecttest2.vi ‏91 KB

    Thanks for your response. I'm new to labview (which isn't really an excuse) and we just went through the real basic stuff for this course. That's why my code just looks like a mess. I'm just trying to use the case selector because I thought it'd be more efficient, since, if I think of it in written code, they're kind of like if-else statements, right? I thought I needed to multiply by a thousand because I am measuring the amplitude of sound input. Whenever I test it out, the numbers are really small. I just figured it'd be easier to multiply it by a thousand and set the range with bigger numbers. I'm also trying to get an LED to light up on a range of volume. That's why I need two comparisons. Like, if the volume is between the range of 2000 to 3000, the green LED lights up, and if it's between 1000 to 2000, then the red LED lights up. If the signal is equal to zero, then no light turns on. Anyway, I scrapped the whole idea of using case selectors because I don't have time to learn my way through it and finish on time. I attached a new version of my VI. It's a more simplified version. I don't know how to connect the LED boolean indicators into my array and into the DAQ Assistant (it's not on the vi yet but I do need one so the program knows to read the output into the LED's on my myDaq box. Sorry for the trouble! Thanks for any advice you can give. 
    Attachments:
    projecttest1.vi ‏55 KB

  • Changing an output box in a case structure to an input box

    Hi, I have been struggling with the following problem in Labview:
    Hi, I was working on a wiring diagram in Labview and I was trying to
    wire an absolute value symbol to the right border of a case structure.
    The problem is that I get an output box (an white filled box with an
    orange border) instead of an input box (an orange filled box). How
    would I change the output box into an input box? I have tried Ray
    Kong's method, which is to add a constant and that would make the box
    solid. It worked only once but when I tried it on another output box
    it did not work. Any suggestions would be appreciated. Please
    include step by step instructions as I am still learning Labview.
    Thank you
    Muhammad Asfour

    The box type will be appropriate for what you have wired to the box.
    When you say you want an "input box", do you REALLY want an input box (ie, a
    connection bringing a value from outside of your case statement to the
    inside of your case statement) or do you mean that you want your output box
    (a connection bringing data from inside your case statement to the outside)
    to be solid orange? The output box will go solid orange when you have a
    connection from EACH case to the box. Remember that a single output box
    (usually on the right side of the case statement) must be connected to
    something in each case of your case statement. It will be filled white
    until all cases are wired.
    Write back if this isn't clear of if I have mis-understood your situation.
    Hope this hel
    ps.
    Jim
    "Muhammad Asfour" wrote in message
    news:[email protected]..
    > Hi, I have been struggling with the following problem in Labview:
    >
    >
    > Hi, I was working on a wiring diagram in Labview and I was trying to
    > wire an absolute value symbol to the right border of a case structure.
    > The problem is that I get an output box (an white filled box with an
    > orange border) instead of an input box (an orange filled box). How
    > would I change the output box into an input box? I have tried Ray
    > Kong's method, which is to add a constant and that would make the box
    > solid. It worked only once but when I tried it on another output box
    > it did not work. Any suggestions would be appreciated. Please
    > include step by step instructions as I am still learning Labview.
    >
    > Thank you
    >
    > Muhammad Asfour

  • Is there any Way to find Which case is Executing in LabVIEW VI programmat​ically and Display it..

    Is there any Way to find Which case is Executing in LabVIEW VI programmatically and Display it..
    Solved!
    Go to Solution.

    I wrote this a few years ago: http://lavag.org/files/file/199-state-machine-foll​ower/
    This JKI RCF Plugin sets the Visible Frame property of a Case Structure while the owning VI is running. Use it to follow the execution through the cases in your string-based State Machine/Sequencer when Execution Highlighting isn't fast enough (and, it's never fast enough).
    The use-case I wrote this to improve is setting a Breakpoint on the Error wire coming out of the main Case Structure and probing the Case Selector terminal so I can float-probe wires during execution. The problem with this is that I had to manually select the current frame every time. This is boring, so I developed this plugin to automatically set the Visible Frame to the case most recently executed.
    You might be able to adapt it to your needs.  The basic idea is that a custom probe on the wire to the Case structure's selection terminal sends a notification to a VI that displays the appropriate case.
    We might be able to help you develop something easier if you'll give us more information.  Is it OK if the code to display the case is in the same VI?
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice

  • Programmatically get names of all cases in a case structure

    Hi All,
              I have a subVI that is a state diagram (controlling some test equipment), with many states (i.e. each "state" is a case of a case structure), a text string chooses the case. All cases are named.
             Within this subVI is it possible for me to programmatically retrieve the text name for each case of this case structure? I wish to be able to retrieve these strings so that the main VI will only be able to call valid states.
            I have error handling to ensure that if an invalid state is called (by using the default case) that an error will be returned to my main vi, yet I would prefer to be able to retrieve the string to prevent any typo's etc.
          Not sure if I've explained this well.
         Thanks,
        ds1
    Solved!
    Go to Solution.

    You can do it with LabVIEW scripting, however, I wouldn't leave scripting in a final application. Use a typedef enum if you don't want to worry about this. If you want to keep it as a string (remember, this is a heavily debated subject) just make sure you test all cases before making it an executable and that should suffice. If you want to check to make sure it's a valid string, this seems like a bit overkill on the error checking! Just work it out when testing, or again as was said above, use a typedef enum.
    CLA, LabVIEW Versions 2010-2013

Maybe you are looking for