AlexKaras's avatar
AlexKaras
Champion Level 3
10 years ago
Status:
Implemented

Make it possible to concatenate the values of two variables into the third one

I would like to ask for the possibility to concatenate the values of two variables into the third one. This can be implemented in the same tables where data are extracted from the responses and assigned to the variables (Data Selectors, etc.).

In this case, the value of the 'Source' field (using Data Selector table as an example) may be 'Variables', 'Regular Expression' will specify the name of the first variable (e.g. @Var1), 'Subexpression' will specify the name of the second variable (e.g. @Var2) and the 'Save to Variable' field will specify the name of the variable that contains concatenation result (e.g. Var3).

It would be perfect, if it is possible for Var1 and Var2 specify not only variable name, but some string that contains (or not) the variable - e.g.: if Var1 = 'CaseId' and Var2 = '123', then '@Var1' and '=@Var2' should concatenate to 'CaseId=123'.

 

Please let me know if you need more details for this request.

  • Hi Alex,

     

    This is already possible within LoadComplete. From the documentation on variable creation (see full article here):

     

    • To concatenate the values of several variables:

      Regular Expression Subexpression Save to Variable Decode
      @Var1@Var2@Var3 $1 ConcatVar Do not decode

      The values of the Var1, Var2 and Var3 variables will be concatenated and saved to ConcatVar. For example, if Var1 = 12, Var2 = oct and Var3 = 13, the ConcatVar variable will contain "12oct13". If you specify Upper case in the Decode cell, the result will be "12OCT13".

     

    Hope this helps.

  • Hi all Sorry for restarting an old post however I think its directly related to the question asked.

     

    I'm saving 3 variables from a response using the "Parameter" tab and then trying to the "Data Selectors" as described above to concatenate these values however it is failing for me

     

    I actually need these variables (concatenated into one) to use in the the Request Header for Request 010 later down the line

     

    Does someone know this would be failing?

     

     

    Many thanks in advance

     

    Omarshot1.pngshot2.png

  • Hi Omar,

     

    I'm not sure, but I think this could be a timing issue. Since you're trying to do it all within the same request, it's possible that LoadComplete is trying to process the variable concatenation before it actually saves those parameters to their respective variables.

     

    I suggest doing the variable concatenation in a data selector for a subsequent request (i.e. requests 5-9), and then try using that concatenated variable where you need it in request 10.

     

     

  • pprajapati's avatar
    pprajapati
    Occasional Visitor

    I am in situation where I need to randomize email addresses in request. 

     

    Steps Taken:

     

    1. Created spreadsheet with all email addresses

    2. Created variable and used it in request

     

    But doing this is failing email address verification as Loadcomplete is converting 'a1@ot.com' to 'a1%40ot.com'.

     

    Need help to make this possible to keep '@' as '@' only.