Traverse Variables in FileGlobals

Is there a way to traverse all the variables under FileGlobals as key and value pair? I'm having trouble finding a function that will give me all the variable names for PropertyObject.
- Jimmy
Solved!
Go to Solution.

First of all I'm confused by your "key and value pair" statement.  What did you mean by that?
Secondly you can use: FileGlobals.GetNthSubPropertyName("", N, 0) to get the name of the sub property.  N is the index.
Here is from the help:
GetNthSubPropertyName Method
Syntax
PropertyObject.GetNthSubPropertyName ( lookupString, index, options)
Return Value
String
Name of the subproperty the index specifies.
Purpose
Returns the name of a subproperty within the property the lookupString parameter specifies.
Parameters
lookupString As String
[In] Pass an empty string to denote the PropertyObject to which the method applies, or pass the name of a subproperty within the PropertyObject. Refer to Lookup Strings for more information about the strings you can use.
index As Long
[In] Pass the zero-based index of the subproperty.
options As Long
[In] Pass 0 to specify the default behavior, or pass one or more PropertyOptions constants. Use the bitwise-OR operator to specify multiple options.
GetNumSubProperties is also a good method to use.  Just call FileGlobals.GetNumSupProperties("").
Hope this helps,
jigg
CTA, CLA
teststandhelp.com
~Will work for kudos and/or BBQ~

Similar Messages

  • Clean Up variables FileGlobals

    Hello to Everybody,
    I hope that some can help me, because I've got a problem with a variables(type fileGlobals. When I close Teststand, after is executes a my sequence, the fileGlobals variables are initialize with the last value, instead of zero.
    Thanks so much.
    I can not understand the reason
    Francesco

    Thanks for the reply ... Now I try to seek and follow your advice. I'll let you know if I solvedthe problem
    Francesco

  • Error while accessing station global in LabVIEW

    I am trying to access the teststand station global value in the LabVIEW using activex methods.
    If I am reading default station global (TS.LastUserName) i am able to read the value.
    However if i am trying to read the value of the string station global which i am updating through running sequence i am getting an error as follows:
    "Unknown variable or property name 'ExecutionTime'.
    Error accessing item 'ExecutionTime'. in GetGlobal.vi" where ExecutionTime is the name of my station global.
    Error code is -17306.
    What is going wrong?

    Couple of suggestions for you:
    If you are trying to read the execution time in your user interface, I suggest: http://zone.ni.com/reference/en-XX/help/370052K-01/tsapiref/reftopics/obsolete_thread_postuimessage_... method to pass data to UI
    Also, station globals are not dynamic like other variables (Locals / FileGlobals etc) which means that you wont get an updated value until the stationglobals.ini file is saved. So depending on what you are trying to read, this may or may not be your best choice.
    Beginner? Try LabVIEW Basics
    Sharing bits of code? Try Snippets or LAVA Code Capture Tool
    Have you tried Quick Drop?, Visit QD Community.

  • Equivalent to Step.Limits.Low.NumericFormat in TestStand 3.1?

    I am looking to set the Limit Numeric Format property (for individual steps) programmatically through the TestStand API.  The link below seems to be talking about the property I need to set (Step.Limits.Low.NumericFormat). 
    http://forums.ni.com/t5/NI-TestStand/How-can-I-tell-that-a-default-numeric-format-has-been-applied-t...
    Unfortunately on my TestStand 3.1 system, the property doesn't exist (or doesn't work as Raj suggests in the post).  Everything is fine on my TS 4.2.1 system.
    Does anyone know the name/location of the property in TS 3.1.  It must exist as it is possible to modify the display format of limits in TS 3.1.  I guess it may not be possible to interact with it through the API which would be a shame.
    Regards
    Steve
    https://decibel.ni.com/content/blogs/DailyCLAD
    Solved!
    Go to Solution.

    Hi Shalini
    Thanks for your post.  It was helpful but I am not quite there.
    If I export a single NumericLimitTest step Step.Limits into LimitLoader format, I get the following:
    <Step Name> Limits
    Numeric Limit Test <Prop Name='Limits' Type='Obj'><Prop Name='Low' Type='Number' NumFmt='%#x'><Value>9</Value></Prop><Prop Name='High' Type='Number' NumFmt='%#x'><Value>11</Value></Prop><Prop Name='LowExpr' Type='String' TypeName='Expression'><Value></Value></Prop><Prop Name='HighExpr' Type='String' TypeName='Expression'><Value></Value></Prop><Prop Name='UseLowExpr' Type='Boolean'><Value>False</Value></Prop><Prop Name='UseHighExpr' Type='Boolean'><Value>False</Value></Prop></Prop>
    <Locals> Variable Value
    <FileGlobals> Variable Value
    <StationGlobals> Variable Value
    So it is the value of 'NumFmt' that I need to set, and the value I need to set it to is '%#x'.......but I am not sure what 'NumFmt' is; it is not a property, it is associated with Limits.Low (and Limits.High), but it isn't a sub property of Limits.Low as Limits.Low is defined as a Number.
    I can successfully import the NumFmt of Limits.Low (using the LimitLoader) in TS 3.1,  but I am missing one last clue defining how it is done in the API
    Regards
    Steve.
    https://decibel.ni.com/content/blogs/DailyCLAD

  • Leave a step running possible in TestStand?

    Hello all,
    In the sequence editor, I have put in a few VI's.  Is it possible to leave the VI's running, move on, open another VI, move on, open yet another VI, and stop them all later in some other step?  I am asking this because one VI is responsible for outputting a signal in an FPGA, and another VI is responsible for measuring some signal from UUT that reacts to the signal from the FPGA.
    And also, is it possible to change a local variable on the test sequence with respect to time?
    Thanks.

    Hi,
    The easiest way is to use the TestStand - Set PropertyValue.vi ( this may not be the actual name but you should find it on the TestStand palette in LabVIEW). You will need the SequenceContext passed into the VI, the full lookup string to the TestStand variable eg FileGlobals.MyValue and the value you wish to set.
    Make sure the TestStand variable is in scope i.e don't expect to set some Locals variable in MainSequence when you are currently running in a sub sequence.
    Hope this gets you start.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • Clone Variables (Locals and FileGlobals)

    Hi !
    Is it possible to clone variables ? 
    I found the way to use the clone method with steps, but I can't find the way to do it with variables.
    What I did is get the reference onto the 'Locals' in sequence (the reference is a PropertyObject). Then cloned this PO using the Clone method, which returns a reference on the cloned Object.
    I have the reference of a sequence in another sequence file, in which I want to copy my variable. But I can't find any method from the Sequence class which would allow to add the cloned variables using the clone refrence.
    Any idea ?

    Hi,
    Clone is possible,
    Just see these threads, there were some examples
    http://forums.ni.com/t5/NI-TestStand/Repeating-a-Failed-Sequence-once-more/m-p/1042268/highlight/tru...
    http://forums.ni.com/t5/NI-TestStand/Copy-result-container-why-do-I-get-a-property-types-do-not-matc...
    Regards
    Juergen
    =s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e=

  • Store object reference in variable resolved by other variable

    Hi everyone,
    In my test setup I use a Thread and I want to store an object ref to that Thread in a variable (type: object reference).
    In the sequence call settings I can provide a variable where I want to store this.
    I've done this before and it all worked fine. When I stop the thread I'm able to use a wait step that waits for the thead to stop by providing the reference I stored when the thread was started.
    Now I want to store the reference in a variable that is based on another variable. In my situation the following construction works. This is way I've entered in the Sequence call settings:
    #NoValidation = True, Evaluate("FileGlobals.ModuleConfig." + Parameters.ModuleInstance + ".ThreadRef")
    As you can see Parameters.ModuleInstance determines in which container the thread ref should be stored. But since this parameter is empty by default the evaluation fails so I have to use #NoValidation.
    This seems a bit ugly to me so I also tried:
    FileGlobals.ModuleConfig.GetPropertyObject(Parameters.ModuleInstance + ".ThreadRef")
    According to teststand this construction is OK, however my thread ref is not stored in this case...
    Is the first option I mentioned the only possible way for my problem? Or are there other, more elegant ways?

    Hi Kayr,
    I agree that the second approach you mention is the more elegant way to accomplish this.  I was able to successfully use this method on my end to access a propertyObject.  Can you send a sample sequence file so I can take a look?
    Al B.
    Staff Software Engineer - TestStand
    CTA/CLD

  • TestStand 1.0.3 upgrade to 2.0 FileGlobals not visable

    Under TestStand 1.0.3, I create a set of data types to define my entire test environment. One example is:
    AnalogDeviceType
    DeviceType String
    Device Number
    DeviceIndex Number
    ResourceName String
    HighLimit Number
    LowLimit Number
    and then
    AnalogDevices
    NumberOfDevices Number
    Configuration Array of Type
    'AnalogDeviceType'[0..2]
    I set up types like this for all the various types of instruments being used. Under FileGlobals, I then defined the different instruments being used. Under TestStand 1.0.3,
    I could go to FileGlobals and edit all of the fields.
    However, with TestStand 2.0, I can edit the Number
    OfDevices but it will not expand the Configuration and allow me to edit those fields. I have been looking through the new features to see if I can determine if I need to set a property flag or something but have not been able to determine what needs to be done. Any thoughts on the subject?
    Also, while I have found some books on LabVIEW 6i, etc. does anyone know good books TestStand.

    There is a known problem that might be related to what you are seeing, however, you should still be able to edit the value you describe.
    The known problem is that selecting Browse Sequence Context from the context menu of an array element or it subproperties will reulst in error -17308 if the array element does not have a name.
    An example of an array element that does not have a name looks something like this
    -MyCustomArray
    |
    |_[0]
    |
    while an array element that has a name looks something like this.
    -MyCustomArray
    |
    |_["MyArrayElement"]([0])
    |
    You will arrays of named elements if you browse RunState.Sequence.Main for any sequence that has named steps in its Main step group.
    By default custom data types you create do not have names. Therefore this
    problem will always occurr in arrays of custom data types.
    This problem has been corrected for future versions of TS.
    The workaround is to select Browse Sequence Context on the array instead of the array element. You can then browse down to the element in the sequence browser.
    However, this problem should not affect the ability to change the values of the array element. I have just created a custom data type as you have described (container of numbers and strings). I then created a file global variable array of this type. After selecting the first element in the tree view of the file globals, the contents of the element are displayed in the list view to the right. If I double click (or select Modify Value from the context menu) on any member of the array element, then I get a dialog box which allows me to change the value.

  • Instance variable to hold the element of a tag in the xml file

    Hi I have an xml file that is handled using this parser
    <attr id="MY_NAME" >
    this parser hanled the above tag but now I want to have it handle
    <attr id="MY_NAME" desc="GOOD">
    but I need to create an instance variable to handle the desc element in the attr tag .
    Can some one help me out as this is not my file and I am having trouble to do please......
    import java.util.*;
    import java.io.*;
    import javax.xml.parsers.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;
       The SupportMatrix class provides static variables and methods to simplify
       the determination of whether or not a given attribute is supported for a
       certain object type (queue manager, channel, etc.), depending on the version
       and platform of the queue manager to which it belongs.
       The SupportMatrix class may not be instantiated. Its constructor is private.
       An instance of the class is created internally in the static initializer so
       that the XML parsing methods are available.
       A corresponding XML document, SupportMatrix.xml, is parsed to create the various
       HashMaps which contain the version/platform dependency information. A number of
       inner classes are used to represent the various elements of the XML matrix
       definition.
       Here's a sample document:
       <!-- The supportmatrix tag opens the document -->
       <supportmatrix>
         <!-- Objects are keyed by classid. "1" is the classid of a queue manager object. -->
         <object classid="1">
           <!-- Versions group attributes according to the queue manager version where they
                were introduced. The "base" cmdlevel encompasses all versions up to 5.1. -->
           <version cmdlevel="base">
             <!-- Attributes are defined by the attr tag. -->
             <attr id="MQCA_Q_MGR_NAME">
               <!-- Support elements define the platform-specific requirements for an attribute. -->
               <support platforms="UNIX,WINDOWS,OS400,VMS,NSK" maxlen="48" type="MQCFST"/>
               <support platforms="MVS" maxlen="4" type="MQCFST"/>
             </attr>
             <attr id="MQCA_Q_MGR_DESC">
               <!-- Specific attribute characteristics, most notably maximum len for string parms,
                    are defined in the support element. As shown in the following example, it may
                    apply to all platforms. -->
               <support platforms="all" maxlen="64" type="MQCFST"/>
             </attr>
             <!-- Support elements are optional. -->
             <attr id="MQIA_PLATFORM"/>
             <attr id="MQIA_COMMAND_LEVEL"/>
           </version>
           <!-- The version element may 'include' other versions. Note that object elements
                may also refer to other objects via the 'include' parm of the object tag.
                This is to allow common attributes (especially for queues and channels) to
                be shared by multiple definitions in order to reduce some of the
                redundancy. -->
           <version cmdlevel="520" include="base">
           </version>
         </object>
       </supportmatrix>
       The inner classes, and their hierarchical relationships are as follows:
         SupportObject - corresponds to the <object> element. Stored in a static HashMap, and
                         keyed by classid.
           VersionObject - corresponds to the <version> element. Stored in a HashMap instance
                           variable of the SupportObject class, keyed by cmdlevel.
             AttributeObject - corresponds to the <attr> element. Stored in a HashMap instance
                               variable of the VersionObject class, keyed by attribute name.
               PlatformObject - corresponds to the <support> element. Stored in HashMaps belonging
                                to the AttributeObjects, keyed by platform. A single PlatformObject
                                instance is created when the support tag is encountered. The
                                "platforms" attribute of the support element is then processed. For
                                each platform in the comma-delimited list, an entry is added to the
                                collection of PlatformObjects. This is to greatly simplify later
                                lookups.
       In order to support the 'include' feature of object and version elements, certain
       functions are recursive. If the attribute to be validated is not found for the passed
       cmdlevel, the 'parent' VersionObject is consulted by means of the 'include' value. If
       the chain of VersionObjects has been exhausted and the attribute in question has still not
       been located, the next SupportObject in the chain is consulted in a similar fashion.
    public class SupportMatrix extends DefaultHandler {
        /** The objects collection holds all the SupportObjects, keyed by classid. */
        private static HashMap objects;
        /** xmlFile will name the xml document to be parsed. Note that using the
            default class loader expects the string to be the path to the file. It must
            NOT begin with the '/' character. */
        private static String xmlFile =
            ResourceManager.getApplicationProperties().getProperty("SupportMatrixFile");
        private Stack stack;
        /** This static initializer allocates the static objects collection, creates an
            instance of the SupportMatrix class for xml parsing purposes, and initiates
            the parse operation to populate the collection. */
        static {
            objects = new HashMap();
            // Create a parser and process the xml doc
            SupportMatrix handler = new SupportMatrix();
            InputSource is = null;
            try {
                is = new InputSource(ClassLoader.getSystemClassLoader().getResourceAsStream(xmlFile));
                XMLReader xmlReader =
                    SAXParserFactory.newInstance().newSAXParser().getXMLReader();
                xmlReader.setFeature("http://xml.org/sax/features/namespaces", true);
                xmlReader.setContentHandler(handler);
                if (is == null) {
                    System.err.println("No input stream, dammit");
                xmlReader.parse(is);
            } catch(Exception e) {
                e.printStackTrace();
        /** Private constuctor, used only for XML parsing. */
        private SupportMatrix() {
            stack = new Stack();
        /** Add a SupportObject instance to the objects collection. */
        private void addObject(SupportObject obj) {
            String key = obj.getClassId();
            objects.put(key, obj);
        /* DefaultHandler methods                                              */
        /** Not used. */
        public void characters(char[] ch, int start, int length) {}
        /** Not used. */
        public void endDocument() {}
        /** For the version, object, and attr elements, pop the top element of the stack. */
        public void endElement(String uri, String localName, String qName) {
            if (localName.equals("version") || localName.equals("object") || localName.equals("attr")) {
                stack.pop();
        /** Not used. */
        public void setDocumentLocator(Locator locator) {}
        /** Not used. */
        public void startDocument() {}
        /** Most of the work is done here. Create the appropriate inner class instance for
            element; for object, version, and attr, push the element onto the stack so that
            child elements may be added to their collections as needed. */
        public void startElement(String uri, String localName, String qName,
                                 Attributes attributes) {
            String include = attributes.getValue("include");
            if (localName.equals("object")) {
                SupportObject obj = new SupportObject(attributes.getValue("classid"), include);
                addObject(obj);
                stack.push(obj);
            } else if ( localName.equals("version")) {
                VersionObject ver = new VersionObject(attributes.getValue("cmdlevel"), include);
                ((SupportObject)stack.peek()).addVersion(ver);
                stack.push(ver);
            } else if ( localName.equals("attr")) {
                AttributeObject a = new AttributeObject(attributes.getValue("id"));
                //String desc = StringFactory.getString(attributes.getValue("desc"));
                //if(desc != null)
                   //     a.setAttribute();
                String readonly = attributes.getValue("readonly");
                String exclude = attributes.getValue("exclude");
                if (include != null && exclude != null) {
                    Log.log(Log.ERROR, this, "include and exclude are mutually exclusive, exclude value ignored");
                    exclude = null;
                if (include != null) {
                    a.setCondition(include, true);
                if (exclude != null) {
                    a.setCondition(exclude, false);
                if (readonly != null)
                    a.setReadonly(readonly.equals("y"));
                ((VersionObject)stack.peek()).addAttr(a);
                stack.push(a);
            } else if (localName.equals("support")) {
                String platforms = attributes.getValue("platforms");
                String readonly = attributes.getValue("readonly");
                String maxlen = attributes.getValue("maxlen");
                String type = attributes.getValue("type");
                int attrType = 0;
                if (type != null) {
                    if (type.equals("MQCFIN")) {
                        attrType = CMQCFC.MQCFT_INTEGER;
                    } else if (type.equals("MQCFIL")) {
                        attrType = CMQCFC.MQCFT_INTEGER_LIST;
                    } else if (type.equals("MQCFST")) {
                        attrType = CMQCFC.MQCFT_STRING;
                    } else if (type.equals("MQCFSL")) {
                        attrType = CMQCFC.MQCFT_STRING_LIST;
                    } else if (type.equals("EXBIN")) {
                        attrType = MqcConstants.EXCFT_BINARY;
                    } else if (type.equals("EXPCF")) {
                        attrType = MqcConstants.EXCFT_PCF;
                PlatformObject p = null;
                if (readonly == null) {
                    p = new PlatformObject(platforms);
                } else {
                    p = new PlatformObject(platforms, readonly.equals("y"));
                String exclude = attributes.getValue("exclude");
                if (include != null && exclude != null) {
                    Log.log(Log.ERROR, this, "include and exclude are mutually exclusive, exclude value ignored");
                    exclude = null;
                if (include != null)
                    p.setCondition(include, true);
                if (exclude != null)
                    p.setCondition(exclude, false);
                if (attrType != 0)
                    p.setType(attrType);
                if (maxlen != null)
                    p.setLen(Integer.parseInt(maxlen));
                ((AttributeObject)stack.peek()).addPlatform(p);
        public static boolean isExported(int attribute, TopologyModelNode node) {
            String name = ResourceManager.getAttributeName(attribute);
            return isExported(name, node);
        public static boolean isExported(String attribute, TopologyModelNode node) {
            // Find the qmgr node to fetch platform and cmdlevel
            TopologyModelNode qmgr = node.getModel().getQMgrNode(node.getAddress());
            // If there's no qmgr for this node, it must be one of 'ours'.
            if (qmgr == null)
                return false;     // None of 'our' objects can be exported to MQSC.
            String classId = node.getClassId();
            String cmdLevel = qmgr.getAttributeValue("MQIA_COMMAND_LEVEL");
            String platform = qmgr.getAttributeValue("MQIA_PLATFORM");
            return isExported(attribute, classId, cmdLevel, platform, node);
        public static boolean isExported(int attribute, String classId, String cmdLevel, String platform,
                                         TopologyModelNode node) {
            String name = ResourceManager.getAttributeName(attribute);
            return isExported(name, classId, cmdLevel, platform, node);
        /** Determine if an attribute is exportable. The attribute name, the classid of the object to
            which it belongs, plus the command level and platform of the queue manager are all needed
            to make this determination.
            Start by finding the AttributeObject for the combination of attribute, classid, and
            command level. If we can't find the AttributeObject, we assume that the attribute
            is not exported. Otherwise, find out if it is exportable for the selected platform.
        public static boolean isExported(String attribute, String classId, String cmdLevel, String platform,
                                         TopologyModelNode node) {
            AttributeObject attr = getAttributeObject(attribute, classId, cmdLevel);
            if (attr == null) {
                return false;
            } else {
                return attr.isExported(platform, node);
        public static boolean isSupported(int attribute, TopologyModelNode node) {
            String name = ResourceManager.getAttributeName(attribute);
            return isSupported(name, node);
        public static boolean isSupported(String attribute, TopologyModelNode node) {
            // Find the qmgr node to fetch platform and cmdlevel
            TopologyModelNode qmgr = node.getModel().getQMgrNode(node.getAddress());
            // If there's no qmgr for this node, it must be one of 'ours'.
            if (qmgr == null)
                return true;
            String classId = node.getClassId();
            String cmdLevel = qmgr.getAttributeValue("MQIA_COMMAND_LEVEL");
            String platform = qmgr.getAttributeValue("MQIA_PLATFORM");
            return isSupported(attribute, classId, cmdLevel, platform);
        public static boolean isSupported(int attribute, String classId, String cmdLevel, String platform) {
            String name = ResourceManager.getAttributeName(attribute);
            return isSupported(name, classId, cmdLevel, platform);
        /** Determine if an attribute is supported. The attribute name, the classid of the object to
            which it belongs, plus the command level and platform of the queue manager are all needed
            to make this determination.
            Start by finding the SupportObject for the classid. If it isn't there, we make the assumption
            (for now) that the attribute is supported. The only classids for which this can occur are
            broker, agent, and the various container objects.
            Propagate the isSupported request to the chain of SupportObjects (based on 'include' values)
            until we get a 'true' result or we run out of SupportObjects. */
        public static boolean isSupported(String attribute, String classId, String cmdLevel, String platform) {
            if (attribute == null)
                return false;
            SupportObject obj = (SupportObject)objects.get(classId);
            // If the object type isn't even in the support matrix, we interpret that to
            // mean that it's a Broker or Agent, in which case all attributes are supported
            // at present.
            if (obj == null)
                return true;
            boolean result = false;
            while (result == false && obj != null) {
                result = obj.isSupported(attribute, cmdLevel, platform);
                if (result == false && obj.getInclude() != null) {
                    obj = (SupportObject)objects.get(obj.getInclude());
                } else
                    obj = null;
            return result;
        /** Locate an AttributeObject for a given attribute name, object type, and command level.
            This is a helper function for the getMaxLen and getType methods. */
        private static AttributeObject getAttributeObject(String attr, String classID, String cmdLevel) {
            AttributeObject result = null;
            SupportObject obj = (SupportObject)objects.get(classID);
            while (result == null && obj != null) {
                result = obj.getAttr(attr, cmdLevel);
                if (result == null && obj.getInclude() != null) {
                    obj = (SupportObject)objects.get(obj.getInclude());
                } else
                    obj = null;
            return result;
        /** Determine the maximum length for a given combintation of attribute name, object type,
            command level, and platform. If the AttributeObject can't be found, or if the length
            hasn't been set, return -1. */
        public static int getMaxLen(String attr, String classId, String cmdLevel, String platform) {
            AttributeObject a = getAttributeObject(attr, classId, cmdLevel);
            if (a == null)
                return -1;
            return a.getMaxLen(platform);
        /** Determine the PCF parm type for a given combintation of attribute name, object type,
            command level, and platform. If the AttributeObject can't be found, or if the length
            hasn't been set, return -1. */
        public static int getType(String attr, String classId, String cmdLevel, String platform) {
            AttributeObject a = getAttributeObject(attr, classId, cmdLevel);
            if (a == null)
                return -1;
            return a.getType(platform);
        /** Inner class to contain platform-specific info for an attribute. */
        class PlatformObject {
            /** This instance variable will contain the comma-delimited string of all
                platforms to which this object applies. */
            private String platform;
            private int maxlen;
            private String condition = null;
            private boolean include;
            private boolean readonly;
            private boolean lenSet;
            private int attrType;
            private boolean typeSet;
            public PlatformObject(String p, boolean readonly) {
                platform = p;
                this.readonly = readonly;
                lenSet = false;
                typeSet = false;
            public PlatformObject(String p) {
                this(p, false);
            public void setCondition(String condition, boolean include) {
                this.condition = condition;
                this.include = include;
            public boolean isReadonly() {
                return readonly;
            public boolean isExported(TopologyModelNode node) {
                if (condition != null) {
                    boolean test = false;
                    try {
                        test = Utilities.evaluateCondition(node, condition);
                    } catch (Exception e) {}
                    if (include ^ test)
                        return false;
                return !readonly;
            public void setLen(int len) {
                maxlen = len;
                lenSet = true;
            public void setType(int type) {
                attrType = type;
                typeSet = true;
            public String getPlatform() {
                return platform;
            public int getMaxLen() {
                if (!lenSet)
                    return -1;
                return maxlen;
            public int getType() {
                if (!typeSet)
                    return -1;
                return attrType;
        /** This class represents a specific MQSeries attribute. It can optionally contain
            instances of the PlatformObject class as needed. When the 'platforms' collection
            is empty, the attribute is supported on all platforms. It is also possible to
            include a PlatformObject for the 'all' platform, if specific attribute characteristics
            need representation. When the 'platforms' collection is non-empty, it will include one
            entry for each platform where the attribute is supported. */
        class AttributeObject {
            private String attribute;
            private String attrValue;
            private HashMap platforms;
            private String condition = null;
            private boolean include;
            private boolean readonly = false;
            public AttributeObject(String a) {
                this(a, false);
            public AttributeObject(String a, boolean readonly) {
                attribute = a;
                platforms = new HashMap();
                this.readonly = readonly;
            public void setCondition(String condition, boolean include) {
                this.condition = condition;
                this.include = include;
            public void setReadonly(boolean readonly) {
                this.readonly = readonly;
            public boolean isReadonly() {
                return readonly;
            public void addPlatform(PlatformObject p) {
                for (StringTokenizer st = new StringTokenizer(p.getPlatform(), ","); st.hasMoreTokens() ;) {
                    platforms.put(st.nextToken(), p);
            public PlatformObject getPlatform(String platform) {
                PlatformObject p = (PlatformObject)platforms.get(platform);
                if (p == null)
                    p = (PlatformObject)platforms.get("all");
                return p;
            public String getAttribute() {
                return attribute;
            public int getMaxLen(String platform) {
                PlatformObject p = getPlatform(platform);
                if (p == null)
                    return -1;
                return p.getMaxLen();
            public int getType(String platform) {
                PlatformObject p = getPlatform(platform);
                if (p == null)
                    return -1;
                return p.getType();
            public boolean isSupported(String platform) {
                if (platforms.isEmpty()) {
                    return true;
                if (platforms.containsKey(platform)) {
                    return true;
                if (platforms.containsKey("all")) {
                    return true;
                return false;
            public boolean isExported(String platform, TopologyModelNode node) {
                if (readonly) {
                    Log.log(Log.DEBUG, this, attribute + " is readonly, returning false");
                    return false;
                if (condition != null) {
                    Log.log(Log.DEBUG, this, "Testing condition = " + condition);
                    boolean test = false;
                    try {
                        test = Utilities.evaluateCondition(node, condition);
                        Log.log(Log.DEBUG, this, "Condition result is " + test);
                    } catch (Exception e) {
                        Log.log(Log.ERROR, this, "Condition through an exception");
                    if (include ^ test)
                        return false;
                if (platforms.isEmpty()) {
                    return true;
                PlatformObject p = getPlatform(platform);
                if (p == null) {
                    Log.log(Log.DEBUG, this, platform + " not found for " + attribute + ", returning false");
                    return false;
                return p.isExported(node);
        /** This class represents a specific value of a queue manager's command level. A
            given instance of this class may 'include' a 'parent' instance through its
            include instance variable. The traversal of the parent/child hierarchy is
            delegated to the SupportObject class, since that is where the collection of
            VersionObjects lives. */
        class VersionObject {
            private String cmdLevel;
            private String include;
            private HashMap attributes;
            public VersionObject(String cmdLevel, String include) {
                this.cmdLevel = cmdLevel;
                this.include = include;
                attributes = new HashMap();
            public void addAttr(AttributeObject attr) {
                attributes.put(attr.getAttribute(), attr);
            public AttributeObject getAttr(String attr) {
                return (AttributeObject)attributes.get(attr);
            public String getCmdLevel() {
                return cmdLevel;
            public String getInclude() {
                return include;
            public boolean isSupported(String attr, String platform) {
                AttributeObject obj = (AttributeObject)attributes.get(attr);
                if (obj == null) {
                    return false;
                } else
                    return obj.isSupported(platform);
        /** This class represents an MQSeries object type, as identified by its classid, e.g.
            queue manager or local queue. This class implements an include facility similar to
            that described for the VersionObject. The traversal of that hierarchy is delegated
            to the static isSupported method, because the collection of SupportObject instances
            is a static variable of the SupportMatrix class. */
        class SupportObject {
            private String classId;
            private String include;
            private HashMap versions;
            public SupportObject(String classId, String include) {
                this.classId = classId;
                this.include = include;
                versions = new HashMap();
            public void addVersion(VersionObject obj) {
                String key = obj.getCmdLevel();
                versions.put(key, obj);
            public String getClassId() {
                return classId;
            public String getInclude() {
                return include;
            public boolean isSupported(String attr, String cmdLevel, String platform) {
                boolean result = false;
                VersionObject obj = (VersionObject)versions.get(cmdLevel);
                if (obj == null)
                    obj = (VersionObject)versions.get("base");
                // I don't actually know what it means if obj is null at this point.
                // It probably can't happen.
                if (obj == null)
                    return false;
                while (result ==  false && obj != null) {
                    result = obj.isSupported(attr, platform);
                    if (result == false && obj.getInclude() != null) {
                        obj = (VersionObject)versions.get(obj.getInclude());
                    } else
                        obj = null;
                return result;
            public AttributeObject getAttr(String attr, String cmdLevel) {
                AttributeObject result = null;
                VersionObject obj = (VersionObject)versions.get(cmdLevel);
                if (obj == null)
                    obj = (VersionObject)versions.get("base");
                // I don't actually know what it means if obj is null at this point.
                // It probably can't happen.
                if (obj == null)
                    return null;
                while (result ==  null && obj != null) {
                    result = obj.getAttr(attr);
                    if (result == null && obj.getInclude() != null)
                        obj = (VersionObject)versions.get(obj.getInclude());
                    else
                        obj = null;
                return result;
    }

    Are you the one who commented out the code you're looking for ?//String desc = StringFactory.getString(attributes.getValue("desc"));You just have to modify you AttributeObject class to hold a new field : String description. And then, it's up to you to create a new constructor or a new setter method.
    Btw, this is not a Swing related question.

  • Using variables in TestStand 4.0

    Hi, I am new to TestStand and I am still a bit puzzled about:
    1. The differences between using Locals / Parameters / FileGlobals / StationGlobals in practices.  (Especially between Locals and FileGlobals, I can’t notice any differences when using them)
    2. When and how you would use a “Object Reference” / “ Container” variable.
    I am hoping that someone can share some demonstrating examples or readings.
    I am also interested to know the most common way/best practice to pass&share variable between sequences.
    I want to avoid using “StationGlobals” because it appears to me that a StationGlobals variable is attached to a particular station/PC, if I run the same sequence file on another machine I will then need to redefine all StationGlobals variables.  (Am I right about this?)
    To get around, I have been using “Parameters” and “Locals”, however I have to say it is tedious and easy to make mistake to pass a top level variable to a subsequence at several levels down. 
    It got to be a better way… A variable type that is global to all sequences but not hardware dependent?
    Thanks a lot.
     Phillip

    Hi Ray,
    It is much appreciated for your thorough answer, it was very good.
    However I had trouble to implement some of suggested solutions.
    *Using FileGlobals with “All Executions Share the Same File Globals”:
    Maybe explaining the application I want to achieve will help. 
    I have Sequence A, B and C.  Sequence A is the top level sequence.
    In A.seq, a “Sequence Call” is used to call B.seq in which a VI is called to initialize a instrument and pass its handle back to A.seq.  (Using a parameter)
    Later in A.seq, another “Sequence Call” is used to call C.seq in which another VI is called to request for a measurement.
    Basically what I am trying to do is to store the instrument handle into a global variable so it can be used by any other subsequences/vi inside A.seq.
    I have tried A.seq with either “Separate File Globals of Each Execution” and “All Executions Share the Same File Globals” under the properties setup.  In both cases, the “File Globals” I created in A.seq, is not available in C.seq.
    (From reading the helps, I think this option is for the situation where I have parallel sequences running.)
    *Using TestStand API PropertyObject.SetVal
    I used “Set Property Value.VI” to create a StationGlobals with the “InsertIfMissing” set to true.  It works fine normally but the problem is that the StationGlobals I want to insert is a custom type and “New Value” input only accepts a string/numeric/Boolean.
    Regards
    Phillip

  • How to store a relative path in a global variable

    Hi,
    I'm using Teststand 2013 and Labview 2013
    Is it possible to define a relative path for a global variable in the Teststand? Ex. "..\vector1.hws"
    Or I should use the Labview functions to solve this issue?
    Thanks,
    Solved!
    Go to Solution.

    Paths are so much easier to manipulate in LabVIEW.  So you could store the relative path as a string and then use LabVIEW to make the absolute path.
    I typically store a folder in a global variable and then I can just concatinate the strings to build the absolute path.  For example:
    FileGlobals.Folder = "C:\\foo\\bar\\",
    Locals.Path = FileGlobals.Folder + "blah.txt"
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Creating and using variables in LabView

    Hello. Apologies in advance for what probably is a trivial task, but I'm having problems grasping the concept of variables in the LabView environment.
    I'm using Motion to track the steps that a motor has traversed. I have an inkjet that I want to apply a quick burst only once for a pixel (which I defined the size). The problem is that the motor has to travel at such a slow speed that the inkjet is over the pixel for a while. With my current code, it will keep firing while over the pixel. So I want to store the last pixel number that the printer fired on so I can perform a compare to ensure that the inkjet will only fire once the current pixel is greater than the last-fired pixel.
    In a regular text-based coding environment, it's as easy as assigning a variable to store the pixel that the inkjet fired on, then constantly compare the current pixel location to that variable to know if it's still over the same pixel. I'm a bit of a loss trying to accomplish the same task using the graphical coding of LabView.
    How do I extract this value and store it for later comparison?
    Thank you and sorry again for a dumb question.

    I assume that you are doing this firing of inkjet at a particular pixel, using a loop ( more appropriately, while loop)
    One way to achieve this would be to use shift registers and case structure
    Insert a shift register for that loop
    initialize a pixel value (numeric) to that shift register
    On every iteration, perform comparison for 'greater than' with current pixel value/position  to value/position stored in shift register
    If the result of this comparison is true, use a case structur. In true case of case structure , fire your inkjet at that particular pixel and update your shift register to replace and store the current value
    If the result of comparison was false, do not perform any operation, just pass the shift register through false case without any modification
    A labVIEW code built on these lines would work fine for your application
    Showing a code snippet would have been a simpler and effective  way to explain this. but currently no LabVIEW installed on my system

  • Can I use RunState.ProcessModelClient.Data.Seq[0].Locals.MyVariable in batch model to set variables in a client sequence?

    I have used RunState.ProcessModelClient.Data.Seq["MainSequence"].Locals.MyVariable to set Locals variables in client sequences running in a sequential model but it doesn't seem to work with the batch model. Using a breakpoint I found that RunState.ProcessModelClient.Data.Seq is a container listing all of the sequences in the client sequence with the Main Sequence being index 0.
    I tried using RunState.ProcessModelClient.Data.Seq[0].Locals.MyVariable to set the variables in my client sequence and it worked fine.
    My question: is this method reliable or am I doing something that might cause problems down the road?
    Thanks,
    Steve

    A few issues from doing it this way-
    1- You should try an make your process model such that it can handle almost any sequence file thrown at it.  MainSequence may not a) contain that local variable and b) be at array element 0.  Unless you do some serious error checking then using your process model elsewhere will be a problem because it will throw errors.
    2- It all depends on where you are changing that variable at.  Remember with the Batch Model that you are dealing with multiple copies of your client sequence.  If you change a Locals in the process model which threads does it actually affect?
    3- Locals is to be used for the sole purpose of the sequence it resides in.  Just like in text based programming where you have a function call:
    MyFunc(int x, int y){
    string foo;
    foo is local and really shouldn't be changed outside of MyFunc.  x and y are parameters and should be how data is shared among different sequences in TestStand.  There are variables for bigger scopes as well (i.e. StationGlobals, FileGlobals). 
    I recommend using either a StationGlobal or passing the data as a parameter. 
    In the end you are the engineer and the flexibility that TestStand gives you makes it so you can do things however you want. 
    My 2 Cents,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • N-ary Trees non-recursive traversal algorithms

    Hi,
    Non-recursive traversals are needed when you are unsure how big the tree's will be. So far all the algorithms I have seen either use their own internal stack
    or threading to climb back up the tree.
    Here's my attempt that seems to work but I would value so critical evaluation
    * An extension of the CommonAST that records the line and column
    * number.  The idea was taken from <a target="_top"
    * href="http://www.jguru.com/jguru/faq/view.jsp?EID=62654">Java Guru
    * FAQ: How can I include line numbers in automatically generated
    * ASTs?</a>.
    * @author Oliver Burn
    * @author lkuehne
    * @version 1.0
    * @see <a target="_top" href="http://www.antlr.org/">ANTLR Website</a>
    public class DetailAST
        public AST getFirstChild()
        public AST getNextSibling()
        public int getChildCount()
        public DetailAST getParent()
        public int getChildCount(int aType)
        public String getText()
    }This was cut back just to give you enough info
         public static AST getLeftMostChild(DetailAST ast) {
              DetailAST tempAst = ast.getFirstChild();
              while (tempAst.getFirstChild() != null) {
                   tempAst = tempAst.getFirstChild();
              return tempAst;
         public static void traverseASTInOrder(DetailAST root) {
              DetailAST current = getLeftMostChild(ast);
              processNode(current);
              while (current != root) {
                   if (current == current.getParent().getFirstChild()) {
                        processNode(current.getParent());
                   if (current.getNextSibling() != null) {
                        DetailAST sibling = current.getNextSibling();
                        if (sibling.getChildCount() != 0) {
                             current = (DetailAST) getLeftMostChild(sibling);
                             processNode(current);
                        } else {
                             current = sibling;
                             processNode(current);
                   } else {
                        current = current.getParent();
            // do stuff at inorder traversal
         public static void processNode(AST current) {
              System.out.println(current.getText());
         }for pre-order and post-order John Cowan put forward this algorithm
    http://lists.xml.org/archives/xml-dev/199811/msg00050.html
    traverse(Node node) {
        Node currentNode = node;
        while (currentNode != null) {
          visit(currentNode); //pre order
          // Move down to first child
          Node nextNode = currentNode.getFirstChild();
          if (nextNode != null) {
            currentNode = nextNode;
            continue;
          // No child nodes, so walk tree
          while (currentNode != null) {
            revisit(currentNode)     // post order
            // Move to sibling if possible.
            nextNode = currentNode.getNextSibling();
            if (nextNode != null) {
              currentNode = nextNode;
              break;
           // Move up
           if (currentNode = node)
          currentNode = null;
           else
          currentNode = currentNode.getParentNode();
      }Any comments, criticisms or suggestions ?
    regards
    David Scurrah

    Stack is recursion? As far as I know recursion is when
    function (method) calls itself. Just using some
    Collection, which java.util.Stack implements is not
    recursion.
    Regards
    PawelStacks are used to implement recursive algorithms. What happens in most languages when you make a function call? Each function has an "activation record" where it stores its local variables and parameters. This activation record is usually allocated on a stack. Thus for any recursive algorithm, there is a non-recursive algorithm that uses a stack.
    In the OP's case you don't need a stack because of the peculiarities of tree traversal when you have a pointer to the parent node. (Namely, no cycles and you can get back to where you've been) So the algorithms he gave should work fine.
    My only "criticism" would be that it may be more useful to implement these algorithms with the iterator pattern. So you would have a tree with some functions like:
    public class Tree{
        public TreeIterator inOrderIteraror();
        public TreeIterator preOrderIterator();
    }Where the TreeIterator would look like a java.util.Iterator, except maybe you want some additional utility methods in there or something.
    Other than that, non-recursive algorithms are defnitely the way to go.

  • How can I pass a variable from Test Stand to CVI by reference

    Hi!
    I can't to pass numeric or boolean variable from Test Stand (for example: FileGlobals.StopFlag) into the step (CVI function).
    Function prototype: 
    void __declspec(dllexport) __cdecl PC2_WaitWhileResponceAppear(tTestData *testData, tTestError *testError, int *iStopFlag).
    When variable has bin changed I can't see this change from my function.
    CVI 2010, Test Stand 2010
    Can anybody help me?

    Hey Rombar,
    It is certainly possible to pass variables by reference; for example, if you go to <TestStand Directory>/Examples/Demo/C and open the computer.seq file, you can see one of the example sequences that uses CVI modules. If you click on one of these steps, you'll see that some of the parameters, such as the error information, is passed with pointers. This is a pass by reference.
    To help narrow this down, it'd be good for us to figure out a few things about how the code is run. First, if you go to Configure > Adapters, select the CVI adapter and choose Configure, you can see options for this adapter. Do you have it configured to run in an external instance of CVI or as an in-process call?
    Also, if you're wanting to see a change made in TestStand in your external code, this makes me think that you're wanting to run the code and then continue to execute your TestStand sequence while the code runs. How did you configure this behavior? For example, are you calling this code as a separate sequence in a new thread, or are you using another method to run this code while the sequence continues to run?
    Finally, if we could see a screenshot of how you're configuring the parameters on the TestStand step, that might be helpful as well.
    Daniel E.
    TestStand Product Support Engineer
    National Instruments

Maybe you are looking for