You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Jose Castro <ok...@gmail.com> on 2008/10/22 17:55:27 UTC

simple variable assignment

I have the following

jdbc
---->regex(refname:soc_req_no_rx,reg expression: (.*),
template:$1$,match:-1, default value:0)

when that is done I access the data that I want like ${soc_seq_no_rx_2}

Since I dont like that I want to have a variable in my users
parameters and just do

jdbc
----->regex
----->beanshell post proceess
       my_user_var = ${soc_seq_no_rx_2}

But that does not work, When I logn the variable my_user_var , I always get 0

What is the correct way to asssign variables?


Thank you

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: simple variable assignment

Posted by sebb <se...@gmail.com>.
On 22/10/2008, Jose Castro <ok...@gmail.com> wrote:
> I have the following
>
>  jdbc
>  ---->regex(refname:soc_req_no_rx,reg expression: (.*),
>  template:$1$,match:-1, default value:0)
>
>  when that is done I access the data that I want like ${soc_seq_no_rx_2}

OK.

>  Since I dont like that I want to have a variable in my users

What do you mean - you don't like that?

>  parameters and just do
>
>  jdbc
>  ----->regex
>  ----->beanshell post proceess
>        my_user_var = ${soc_seq_no_rx_2}
>
>  But that does not work, When I logn the variable my_user_var , I always get 0
>
>  What is the correct way to asssign variables?
>
What variables are you talking about?
If you are referring to setting a BeanShell variable from a JMeter
variable then you need to use:

my_user_var = vars.get("soc_seq_no_rx_2")

The assignment:

my_user_var = ${soc_seq_no_rx_2}

will only work if soc_seq_no_rx_2 is numeric. If it is text, BeanShell
will see something like

my_user_var = here is the extracted text

which is not valid.

Remember that variable (and function) references are evaluated before
BeanShell sees the script.

>
>  Thank you
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org