Example Code

Creating a Case Structure and Populating the Cases using VI Scripting

Code and Documents

Attachment

Overview
This example VI demonstrates the method to programmatically create an Case Structure using VI Scripting.

Description

The need may arise within a program to update the values of a control such as an Enum or Ring Control during Run Time. In this case there are a couple of things to be aware of.

Firstly, this is possible by VI Scripting as can be seen here and here. Secondly, the method used to update the Text Ring as in this example can not be used for Enumerated Controls - this alone can be done by VI Scripting. In the following VI, a simple Property Node can be created from Right Clicking on the Text Ring Control in question. The property to be selected in this case is Strings[].

In this case, it is put in a little more context by the String Search functions used to populate it - this could be any string from any source.

 

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Open the VI " Ring Changer 2012 NIVerified.vi"
  2. Fill the Original String Values with whatever Values.
  3. Run the VI.

 

Additional Information or References
VI SnippetBlock Diagram.png

 

 **This document has been updated to meet the current required format for the NI Code Exchange.**

James W
Controls Systems Engineer
STFC

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Herlag
Member
Member
on

Hi James,

Nice and useful job.

HL

ChuckS
Member
Member
on

I agree nice ... saved me some work

Frank_Pontes
Member
Member
on

HI James, would you be so kind to save the file so it is compatible with Labview 2010?

Varunesh
Member
Member
on

great

eldiego
Member
Member
on

Great job, James!

Is it possible to do the opposite? Create and populate an array of strings where each string is the case label.

CLA
JTG_Wilson
Member
Member
on

Hi Eldiego,

You can probably do what you are asking by using the FrameNames property node. If you search in the example finder for 'scripting' and load the VI Scripting with Structures - Case Structure.vi it will show you various properites for case strucutres that you can get and set using VI scripting.

I hope this helps.

James W
Controls Systems Engineer
STFC
tmccrack
Member
Member
on

Nice, just used this for generating cases for a queued state machine. Thanks