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?

Similar Messages

  • Assign string into variable

    Hi All!
    I''ve created global and lоcal variable with type - string
    How can I assign the value into variable in BR?
    I tried [Var_1] = "qwe"; or [Var_1] = @CONCATENATE (String_1, String_2) it doesn't work
    Regards
    Sasha

    You should be able to take global/local variables from HBR into the code and use concatenate within the HBR.
    Something like
    @CONCATENATE([varName1], [varName2]) shouldn't be a problem, so long as the values are good.
    Regards,
    Cameron Lackpour

  • 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.

  • Process variable string into filename at Save service

    Hello,
    Does anyone know how to put a string into the Pathname Pattern (Template) property of a Save service (FileUtilsService - Write Document) ?
    What I'm trying to do is strip the /'s out of a date string and put that date into a filename. For example, 042208_Greg.pdf
    Instead I get d:\WMS\C0419\04\22\08\_Greg.pdf
    I want: d:\WMS\C0419\042208_Greg.pdf
    I have a Set Value service putting a form submit date (MM/DD/YY format) into a process variable called @stringDate. I am stripping /'s out of the date and setting @stringDate like so: /process_data/@stringDate <--- concat(substring(/process_data/xfaform/object/data/xdp/datasets/data/C0419/Approvers/Init iator/Date,1,2),substring(/process_data/xfaform/object/data/xdp/datasets/data/C0419/Approv ers/Initiator/Date,4,5),substring(/process_data/xfaform/object/data/xdp/datasets/data/C041 9/Approvers/Initiator/Date,7,8))
    At the Save file service, I am using @stringDate in my Pathname Pattern (Template) to create the filename: d:\WMS\C0419\{/process_data/@stringDate}_{$/process_data/xfaform/object/data/xdp/datasets /data/C0419/Approvers/Initiator/CompletedBy/Name$}.pdf
    Thanks,
    Greg
    Needham, MA

    Hi Greg
    You've done a great job getting this done with xpath.
    It looks to me like you've done everything right - what's not working - are you getting an exception, or is the file being saved with the wrong name?
    There is a nice little DateFormatter component here, that might make things a little easier/flexible.
    http://avoka.dnsalias.com/confluence/display/Public/Formatter+DSC
    Howard

  • 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

  • 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"

  • Need to validate file Name,split the file name and store the splited values into Variables

    Dear All,
    Below is the my requirement.
    I have a folder, in that folder I have bunch of text files. The file name is below format
    ACA_122_pay_20140430_001
    Initially the file name start with ACA code,groupid,group name and date time stamp. This is the standard structure of file name.
    I want to check each and every file in the folder with this structure. The structure should be standard for all the files. If the structure same for all files I need to get codes form file name. For example
    If you see the below file name, I need to get ACA and put into variable,I need to get 122 and put into variable. For group name and date time needs to put in variable.
    If the file format is not valid state then I need to log exception.
    Let me know if I am not clear.
    Kindly provide the C# code for achieving the above requirement.
    As I am new to .net programming. kindly help me.
    Thanks in Advance,
    Regards,
    Madhava Ganji
    Madhava Ganji

    Hi MadhavaGanji,
    I have post how to validate the file name, header row against definition table which stored the file name and column definition. 
    Take a look and see if this is helpful.
    http://sqlage.blogspot.com/2013/11/ssis-validate-file-header-against.html
    http://sqlage.blogspot.com/

  • Using contents of a String as the name for a variable

    I'm trying to write code that will evaluate the contents of a String variable and then use the contents as the name for an object. For example, my program will create an unknown number of Student objects. I would like to name the Student objects student1, student2,... . In the code below, how do I get the last line of the method to create a new Student called something like "student3" instead of "varName"? Thanks, Julie
    int numberOfStudents= 0;
    public void createStudent()
       numberOfStudents++;
       String varName = "student" + numberOfStudents;
       Student varName = new Student();
    }

    The name of the reference variable is irrelevant to the functional aspect of the application. The 'Name' should be a property of the student class. EG
    class Student {
    private String name;
    public String getName() { return name; }
    public void setName() { this.name = name; }
    public Student() { this(null); }
    public Student(String name) { setName(name); }
    now your code becomes
    public void createStudent() {
    numberOfStudents++;
    Student newStudent =
    new Student("student"+numberOfStudents);
    // now do something with the new student...
    If you're expecting to use the 'Student' instance outside of this method you need to store a reference to it somewhere more accessible (like a field, in a list or an array) or return the reference from this method...

  • 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+"\"";

  • 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];
    }

  • Anonymous PL/SQL . Illegal variable Name/number.

    Hi
    I have tested ODP.NET in ASP.NET for upload images. But when read back from DB then save image to local drive. When I tested given sample code working fine. But when I modify code only select statment in PL/SQL it gives error.
    Following statment is the error. Illegal variable Name/number. Pl.
    advice me what need to change.
    Dim block As String = " BEGIN " & _
    " SELECT Ad_Image into :2 from Printmedia WHERE Product_ID = " + ProdID + ";" & _
    " end ;"

    You use bind variables. Great!
    And then you do not use bind variables. Bummer!!
    Why can you make the output from the SQL a bind variable, but you do not supply Product ID as a bind variable? This causes a unique and non-sharable SQL statement in the SQL Shared Pool. Where the emphasis is very obvious - shared SQL.
    The definition should be something like this:
    Dim block As String = "BEGIN SELECT Ad_Image into :1 from Printmedia WHERE Product_ID = :2; END;"But why are you using an anonymous PL/SQL block and a bind variable to get to the image? Deal with it as a cursor. Much easier. E.g.
    Dim cursorSQL As String = "SELECT Ad_Image FROM Printmedia WHERE Product_ID = :1"Open the cursor. And there you have the resulting image column as a result.

  • Convert string into XML inside BPEL

    Hello ,
    How to convert string into xml format ? And make element and define attribute inside it ??

    There are several problems with your input:
    1. Your xml is not well-formed because the attribute values should be enclosed withing double " quotes and not single ' quotes;
    2. You use a prefix (sml) for the folowing part but you dont define the namespace:
    <ids>
    <VID ID="new"/>
    <data>
    <*sml:*attr name="std">
    <sml:value></sml:value>
    </sml:attr>
    <sml:attr name="xde">
    <sml:value></sml:value>
    </sml:attr>
    </data>
    </ids>
    Complete message should be:
    <ids xmlns:sml="somenamespace">
    <VID ID="new"/>
    <data>
    <sml:attr name="std">
    <sml:value></sml:value>
    </sml:attr>
    <sml:attr name="xde">
    <sml:value></sml:value>
    </sml:attr>
    </data>
    </ids>
    3. Do you assign this expression to a variable that is based on the schema of your message you want to parse
    Regards,
    Melvin
    * TIP Answer the question as helpful or correct if it helps you , so that someone else will be knowing that this solution helped you or worked for you and also it gives points to the person who answers the question. *

Maybe you are looking for

  • Can I move one of my subscriptions to another Adobe ID?

    Sorry, I've tried to ask this through the "Available 24/7" chat, but it just says "Chat not available now" (this has happened the last 2 times I tried chat, so I guess the 24/7 thing really needs to be changed). I have 2 subscriptions through the sam

  • Link Documents to Purchase Order. How?

    Hi Everybody, I need help in linking documents which are available in DRAW , DRAD tables to Purchase order while creating a PO in ME21N. By passing material number to object key in drad table I can get the document number , version etc... How should

  • Upgraded Leopard -- Snow Leopard; What About Boot Camp?

    I upgraded Leopard on my iMac to Snow Leopard, and didn't even think about my Boot Camp partition. I guess I would have assumed the installer would have seen I had this partition and offered to update to Boot Camp 3.0, but when I checked last night i

  • What does the I phone 4s newest update the 6.1 do for the I phone 4s??

    What does the I phone newest update the 6.1 do for the I phone 4s

  • Form does not contain Fragments when I run it

    Hi Folks, I've got a form which uses fragments.This form previews fine in the designer, but when I try to run it using generatePDF Output in a process, the parts that come from the fragments are gone. The following entries are in the log: 2011-03-04