LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cases programmatically from xml in case structure

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

0 Kudos
Message 1 of 12
(4,144 Views)

This is only possible in the IDE when the vi with the case structure is not running. You can use VI scripting to programatically create the cases.

 

Felix

0 Kudos
Message 2 of 12
(4,138 Views)

I want to create a service of this vi. So when it reads the xml it need to update its case structure.

0 Kudos
Message 3 of 12
(4,135 Views)

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>

 

controls case structure.png 

 

contains case structure.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Download All
Message 4 of 12
(4,133 Views)

Are you planning to programmatically add code inside the new frames from information in the XML file?

JKI's award winning EasyXML Toolkit can help you process your XML files.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 5 of 12
(4,117 Views)

Depending on what you are trying to do, it may be easier to replace the case structure with a LabVOOP command VI (see command pattern here).  This will allow you to dynamically add code as well as "cases."

 

What problem are you trying to solve?

Message 6 of 12
(4,088 Views)

It's not realy a problem. It's more an implementation. I have a config file in XML and I want a process configure it's ID's along this XML structure.

0 Kudos
Message 7 of 12
(4,079 Views)

Are you changing just the IDs or also the code which executes for each ID?

0 Kudos
Message 8 of 12
(4,069 Views)

the code also....

0 Kudos
Message 9 of 12
(4,054 Views)

Then you do want a command pattern.  You have a couple of options.

 

  1. Use the LabVOOP command pattern linked above.  This probably the easiest way to do it.
  2. Instead of having a case structure, call a subVI dynamically using VI server.  The subVI selection is made based on the "case" you want to execute.  This is a manual version of option 1 and is the old school way we would have used before LabVOOP was created.

Note that in both cases you can use a subpanel to host a UI for each new plug-in.  This works quite well.  Let us know if you need more information.

0 Kudos
Message 10 of 12
(4,017 Views)