Variable name to string

Hi, I'm really new to TestStand, so this is probably an easy question:
I'm using TestStand 4.5 and I'm trying to convert the name of a variable, Locals.MaxArrayIndex, which is a numeric variable, into a String, Locals.VarString.
I know that the Str() function can be used to convert a numeric into a String, but how can I store the actual words "Locals.MaxArrayIndex" in a string?
Thanks! 

Hmmm...it works great for Parameters that are arrays, but for me it won't work if the Parameter is a numeric variable. Maybe I'm making a mistake somewhere else that I'm not picking up; so I attached the sequence file if you want to take a look at it.
The issue arises in the 'Else' statement. I'm pretty sure the syntax in my function and popup are correct, but the String (ParamName) that is supposed to hold the value of the Parameter variable name (DataSelect) doesn't seem to ever be filled and outputted in the error message.
I would really appreciate it if any of you guys could have a look at the file (I'm sure I'm making some kind of really rookie mistake)
Thanks! 
Attachments:
GenerateError.seq ‏9 KB

Similar Messages

  • Javascript variable names in strings

    This should be easy, but i can't find any info on how to do
    it!
    It's easy to put the contents of a variable into a string but
    how does one place the name of a Javascript variable into a
    string??
    The only solution i have found is to store the name
    separately as a string, but this isn't very neat.

    OK, simple statement first:
    Integer does not equal string.
    You also seem to be tossing around "runtime" and "static" somewhat liberally. Once you wire an integer (be it a control or block diagram constant) to the case structure's selector, the cases can only take on integer values. This is by design. If you wire a string, the case items take on string values. If you wire an enum, the case items take on the enumeration values. Once you've defined a case structure's cases you can't change them at "runtime". This, by definition, is different code.
    That said, it seems to me that you're looking for an enum.

  • Substitute a variable name by String ?

    Hi
    is it possible to substitute a variable name by a String ? if yes then please tell me how :-)
    thx
    pain

    You might be able to use the Reflection API to get what you want, but every other time this question's been asked the asker really needed to use a HashMap instead...
    Good Luck
    Lee

  • Accessing variable names using String

    I have to check up to 13 JCheckBox variables to see if they are checked or not, and I have the variables named: count1, count2, count3,...,count13. I wanted to know if there was a way to go through them in a while loop until I found the last one that was checked. I want to do the following:
    int i = 1;
    while([count+i].isSelected()) {
    i++;
    int foodCount = i;
    //foodCount is stored in database
    I am doing this for a pet store and I don't want to have 12 extra columns in the database - I just want to have one for the overall food count. Any ideas how I can dynamically create a variable name?

    Put the JCheckBoxes in an arrayJCheckBox[] myCheckBoxes = {check1, check2, check3,...,check13};
    JCheckBox someCheckBox = null;
    for (int x=0; x<myCheckBoxes.length; x++) {
      if (myCheckBoxes[x].isSelected()) someCheckBox = myCheckBox[x];
    }

  • Stored Procedure - variable name inside string [EXEC]

    Hi everyone
    I'm looking for a solution for this problem:
    I've created a stored procedure, in which i need to insert a record in a table.
    The point is i don't know the exact column to put my values and which values to save: it depends from the input data.
    I've created a function wich creates (concats) my query.
    The result is similar to:
    SET @myquery = 'INSERT INTO MyTable (columnABC, columnDEF) VALUES (@valueABC, @valueDEF)'
    This query is the value of a varchar.
    I want to execute this query, so I thought to use: EXEC(@myquery)
    The problem is that SQL can't find the variables @valueABC or @valueDEF if thery're inside a nvarchar.
    Is there some particular syntax in order to replace the value of variables?
    I hope it's clear!!
    Thank you in advance!!!!!
    Federica

    You need to create an entire SQL string without the variables.
    SET @myquery = 'INSERT INTO MyTable (columnABC, columnDEF) VALUES (''' + @valueABC + ''', ''' + @valueDEF + ''')'
    Please, please don't post such bad solutions!
    If you use dynamic SQL, you should use a parameterised statement:
    SET @myquery = 'INSERT INTO MyTable (columnABC, columnDEF) VALUES (@valueABC, @valueDEF)'
    EXEC sp_executesql @myquery, N'@valueABC int, @valueDEF int',
         @valueABC, @valueDEF
    However, I would prefer not to use dynamic SQL at all, but do:
    INSERT tbl(keycol, col1, col2, col3, ....)
       VALUES (@keyval,
               CASE @coltoinsert WHEN 'col1' THEN @val END,
               CASE @coltoinsert WHEN 'col2' THEN @val END,
    Although the entire idea of not knowing the columns before sounds spooky to me. A column in a table is supposed to model a unique attribute.
    Erland Sommarskog, SQL Server MVP, [email protected]
    sp_Executesql worked for me, than you very much!!!

  • Dynamic Variable name (for int/long) from a String variable

    Hi,
    I want to give a int/long variable name from a String.
    for ex.
    String str = lookup + "Id";
    lookup is a String variable coming from XML. Now, for instance lookup="name". So str = "nameId".
    Now I want to create a int/long variable by nameId.
    Could anybody tell me the way how to do. Please don't tell to use MAP.
    Edited by: Shah on Dec 5, 2007 3:26 PM

    Well you can't. Use a Map.
    The compiler translates variable names into slot numbers, either within an object or withing the local "stack frame" and these slot numbers are assigned names at compile time. No new slots can be created at run time. Java is not Basic.
    Reflection allows you to find existing field names and methods (not local variables), so it's possible to map, for example, XML attribute names to field names or setters in an object but the names have to be known at compile time.

  • Putting quote round a variable name to make a string

    Hi,
    Hopefully this is a fairly simple task.
    I would like to take a variable name, say Hyp, from my main program and call it in a class, captured in a variable called A and create a string with double quotes surrounding it... to give an answer of "Hyp" which can be used in my program for a further class call which needs the name in quotes.
    I've tried using
    String concat = """+A+""" but this results in an invalid AssignmentOperator
    If I use
    String concat = ""+A+"" I get Hyp with out the quotes - not what is required
    If I use
    String concat = "'"+A+"'" I get 'Hyp' which does not work with the further class which requires "Hyp"
    Can anyone help?

    Escape it with a \ like this:
    String concat = "\""+A+"\"";

  • Generate variable name from a String

    I've got a String "MyVariable" and I need to reference a static variable named MyStaticClass.MyVariable. How do you turn a String into a variable name?

    You can't easily do it... you can using reflection:
    MyStaticClass.class.getField().getXXX("MyVariable") //depending on what type the field is...But this seems like it may be a flawed design. Maybe you should try making a static HashMap in the class, use a Static init block and static get/set methods:
    public class StaticClass
        static Map properties;
        static
            properties = new HashMap();
            properties.put("MyVariable", "Some Value");
            properties.put("OtherVariable", new Integer(3));
        public static Object get(String property)
            return properties.get(property);
        public static void set(String property, Object value)
            //Maybe some code checking to make sure object is right type
            //or don't use a set method at all to make the properties immutable
            properties.put(property, value);
    }

  • Obtain string of IN variable name in PL/SQL

    Hi,
    Odd question. Is there a way to access an IN variable's object name in a procedure?
    eg.
    procedure (var1    IN VARCHAR2(6),
                    var2    IN VARCHAR2(6),
                    var3    IN VARCHAR2(6))
    IS....You run this procedure and pass in parameters of:
    var1 => 'abcdef',
    var2 => 'defghi',
    var3 => 'ghikjl';
    In the code, I want to access the number in the string of the +variable name: var1+
    In a naive sense,
    num_of_in_var := substr(var1, 4,1) would be what i was hoping to achieve, but,
    var1 is set to 'abcdef' so,
    num_of_in_var := substr(var1, 4,1) would return 'd'.
    Any thoughts?
    Thanks
    Edited by: chris001 on Nov 20, 2012 1:16 PM

    Here's an example of how (what you want to do using a procedure or function), can be done using a ADT/UDT (Advance/User Defined Type) in Oracle.
    This approach will not work for standard procedures and functions as this type of dynamic referencing of the code unit/object to itself, is not possible.
    SQL> create or replace type TSomeObject as object(
      2          name    varchar2(10),
      3          id      integer,
      4          day     date,
      5 
      6          member function PropertyByNumber( n integer ) return varchar2
      7  );
      8  /
    Type created.
    SQL>
    SQL> create or replace type body TSomeObject as
      2 
      3          member function PropertyByNumber( n integer ) return varchar2 is
      4                  PLSQL_PROP_GET  constant varchar2(1000) :=
      5                          'declare
      6                                  obj     TSomeObject;
      7                          begin
      8                                  obj := :1;
      9                                  :2 := to_char( obj.#PROPERTY# );
    10                          end;';
    11 
    12                  type            TStrings is table of varchar2(30);
    13                  property        TStrings;
    14                  dynamicBlock    varchar2(1000);
    15                  res             varchar2(4000);
    16          begin
    17                  select
    18                          a.attr_name bulk collect into property
    19                  from    user_type_attrs a
    20                  where   a.type_name = 'TSOMEOBJECT'
    21                  order by
    22                          a.attr_no;
    23 
    24                  dynamicBlock := replace( PLSQL_PROP_GET, '#PROPERTY#', property(n) );
    25                  execute immediate dynamicBlock
    26                  using   in self,
    27                          out res;
    28 
    29                  return( res );
    30          end;
    31 
    32  end;
    33  /
    Type body created.
    SQL>
    SQL> declare
      2          obj     TSomeObject;
      3  begin
      4          obj := new TSomeObject( 'John Doe', 123, trunc(sysdate) );
      5 
      6          for i in 1..3 loop
      7                  dbms_output.put_line( 'property '||i||'='||obj.PropertyByNumber(i) );
      8          end loop;
      9  end;
    10  /
    property 1=John Doe
    property 2=123
    property 3=2012/11/23 00:00:00
    PL/SQL procedure successfully completed.
    SQL> Simplistic example (the PropertyByNumber could be a static class method defined in the abstract parent class) - and one that requires the object to essentially duplicate itself via a bind variable call to dynamic code. Not really the best of approaches, but demonstrates the flexibility (to do even interestingly weird stuff) in PL/SQL.

  • How to build a connection string if "Only variable names (i.e.: $variable) may be used as the target of an assignment statement."

    im looping through databases on a server & building  a connection string to each database.
    $SQLConn.ConnectionString = "Server=$SrvName; Database=$DBName; User ID =DBLogin; Password=myPassword;"
    The problem is i get this error:
    Only variable names (i.e.: $variable) may be used as the target of an assignment statement
    I can put the code into an Inlinescript, but then I lose the ability to perform paralellism. Is there any way to construct the connection string in PS Workflow without using an Inlinescript?

    Hi Winston,
    Why not just wrap the InlineScript blocks in a Parallel block, to cause them to execute in parallel?
    For example:
    workflow foo {
    parallel {
    inlinescript {
    start-sleep -Seconds (Get-Random -Minimum 1 -maximum 5)
    "a"
    inlinescript {
    start-sleep -Seconds (Get-Random -Minimum 1 -maximum 5)
    "b"
    Sometimes outputs "a b" and sometimes outputs "b a"

  • Concatinating Strings into Variable Names

    Hi
    I'm not sure if this is even possible but here goes.
    Is there anyway of concatinating (sp? Join together!) two strings and then use the new string as a variable name.
    The reason I ask is that, depending upon what character I read into my program I will want to modify an array of data associated with that character.
    For example if the character read in was @ I would want to modify the array data@. So my question is, is it possible to read in a character such as @, join it with the string "data" and then use the resulting string as a variable name?
    Apologies if this has a simple solution but I'm struggling to come up with it by myself.
    Many thanks.

    Hey
    Thanks for the advice. The problem is that I'm storing the arrays in a hash map already. This is because each character has more than one piece of data associated with it , and as far as I can tell each key entry in a hash table has one and only one piece of data associated with it. But if there is a way of storing multiple pieces of information with a particular key, then that could be a possible solution....
    Any suggestions?

  • Using a variable's definition as a variable name

    I have a string variable with definition I need to use as a
    variable name.
    For example, this is super simplified:
    var newVariable = 'it is working';
    var partOne:String = 'new';
    var partTwo:String = 'Variable';
    var partThree = partOne + partTwo;
    trace("my variable is " + partThree);
    Instead of tracing partThree as literally partOne + partTwo
    (which traces "newVariable") i'd like it to trace the
    Definition of partOne + partTwo (which is "it is working").
    I hope this makes sense, help or advice is
    appreciated.

    ...
    var partThree = this[partOne + partTwo];
    trace("my variable is " + partThree); //will trace: my
    variable is it is working
    TS

  • Servicegen - Issue with Variable Names - WLS 8.1

    Hi Experts
    I am trying to expose an EJB as a Webservice.. I assembled the ear using SERVICEGEN exposed by Weblogic 8.1
    To my dismay the generated WSDL (even the web-services.xml) are not having the variable names which I gave in my webservice method. Instead I get String, String0, String1 and so on...
    Kindly help me get over this problem.
    Thanks and Regards,
    Gopal.

    your application miight not be using this libraries but there are many shared libraries which are configured could be using. please check whether config.xml file of your domain contains the entries for this library.Problem running simple portal tutorial question

  • How do I create a variable name on the fly?

    Hi,
    If I have a String containing a value, how do I create a variable name using that value during program execution? That is if I have
    String fred = "newvar";
    How do I then create a new String with the name "newvar" (using the contents of fred)? I will never know what the content of fred is until this point. What I'd like to be able to do is something like
    String fred.subString(0) = "a new value";
    Obviously this won't work but if it did the statement would evaluate to something like
    String newvar = "a new value";
    Appreciate any help you can give,
    Dave.

    Here u go:
       private JCheckBox AddCheckBox( String strText, int nTextID )
          JCheckBox checkbox = null;
          Class checkboxDefinition;
          Class[] stringArgsClass = new Class[] {String.class};
          Constructor stringArgsConstructor;
          Object[] stringArgs = null;
          String arg = "";
          arg = "CheckBox" + nTextID;
          String label = new String(arg);
          stringArgs = new Object[] {label};
          try
            checkboxDefinition = Class.forName("javax.swing.JCheckBox");
            stringArgsConstructor = checkboxDefinition.getConstructor(stringArgsClass);
            checkbox = (JCheckBox) createObject(stringArgsConstructor, stringArgs);
            checkbox.setName(label);
            checkbox.setText(strText);
            checkbox.setSize(new java.awt.Dimension(CQuestionBase.PAGEWIDTH, 21));
            checkbox.putClientProperty("1",new Integer(nTextID));
            checkbox.setVisible(true);
          catch (ClassNotFoundException e)
            System.out.println(e);
          catch (NoSuchMethodException e)
            System.out.println(e);
          return checkbox;
       }This code was based on an example I found about two years ago. You can use the same methodolgy to create objects of any kind. Again, look at java.lang.Reflect.

  • Dynamically creating variable names in javascript

    Hi.
    I have to create variable names dynamically in JavaScript.
    My JSP file accesses information from Database and forms a String corresponding to the information received.
    This String is passed to a JAvaScript function that should CREATE a variable with that NAME.
    For Ex:
    My database access resulted in a single row...
    id name sal
    34 John Smith 38000
    the resulting VARIABLE NAME should be Menu34. 34 comes from the database result.
    Is there any function to dynamically create a variable name in JavaScript?
    Thanks in advance.

    The JSP is printing the contents of an HTML page, and Javascript code can be part of that output...
    So you would just write out the stuff, something like this....
    <script>
    <% while(rs.hasNext()) { %>
    var Menu<%= rs.getInt("id") %> = '<%= rs.getString("name") %>';
    <% } %>
    </script>
    In the browser, it'll just look like another long list of Javascript variables.

Maybe you are looking for

  • How to use a different port in RMI

    Hi , We cannot use default port 1099 in RMI due to some restrictions. I want to user port: 8000 instead. Can some one please help how to use a different port? Thanks Arun

  • Can some one please tell me how to apply wine on apps?

    i have downloaded wine but i dont know how to use it????can someone please help me....

  • Java.rmi.MarshalException: CORBA COMM_FAILURE 1398079691

    I am facing a problem in Weblogic 8.1 with service pack 4. I have deployed an EJB that parses an xml and transforms that to an another xml. If we send an xml with less data...say for example, the file size is around 5KB, then it works fine. If we sen

  • RAM_FULL_BUILD - ERROR

    Currently on Oracle Express 6.34 Whilst performinfg a RAM build (Reading Relational Access Manager Build/Hybrid definition) I got the following error RAM_FULL_BUILD - ERROR - http://AB.DBA does not exist in any attached database.. Build log as follow

  • Explain the logic in the code

    HI all, Can anyone explain the logic in the code ? This is to display the pages numbers in page 1 of 4                                                          page 2 of 4 format. i got this code in one of the forum. if the lineno is less then 64, th