On 11/04/2008, Dan Tripp <[EMAIL PROTECTED]> wrote:
> Howdy All,
>
>  I'm trying to perform some simple calculations with data I've extracted 
> using an HTTP sampler and the Regular Expression Extractor.  I have no 
> problem getting the values I need/want/expect from the Regex, but I can't 
> seem to add numbers together, and I can't seem to figure out *WHERE* the 
> calculations should go.
>
>  The simplest sample I've come up with looks like this:
>
>  Test Plan
>  + Thread Group
>   - User Defined Variables
>   - Debug Sampler
>   - View Results Tree
>  Workbench
>
>  In User Defined Variables, I have:
>
>  Name    Value
>  ======  ================================
>  var1    __eval(30 + 6)

__eval() does not evaluate numeric expressions.

You can use intSum() for adding/subtracting numbers, otherwise use Jexl.

>  var2    ${__eval(30 + 6)}
>  var3    10 / 4
>  var4    ${__eval(10 / 4)}
>  var5    ${__time(YMD)}
>  column  uname
>  table   users
>  sql     SELECT ${column} FROM ${table}
>
>  The output I see from the Debug Sampler is NOT what I'd expect:
>
>  var1 = __eval(30 + 6)
>  var2 = ${__eval(30 + 6)}
>  - I was hoping to get "36"
>
>  var3 = 10 / 4
>  var4 = ${__eval(10 / 4)}
>  - I was hoping to get "2"
>
>  var5 = ${__time(YMD)}
>  - I was hoping to get "20080410"
>
>  column = uname
>  table = users
>  sql = SELECT ${column} FROM ${table}
>  I was hoping to get "SELECT uname FROM users"

UDV variables are not defined until the entire element has been processed.
If you put sql in a separate UDV it should work.

>  It may be the case that User Defined Variables is just a convenience 
> component which makes it easier to define variables than it would be to 
> import them from a text file and that my use of this component is 
> wayward/errant.  However, I don't know where the heck to put this stuff if 
> this is the wrong place.
>
>  Further, I don't seem to be able to get the expected values when I put these 
> types of expressions in other components... UNLESS I put them in the title.  
> The ${__time(YMD)} works great if I put it in a COMPONENT LABEL (ie.- I name 
> that component "Today is ${__time(YMD)}" I'll see "Today is 20080410" in the 
> results), but doesn't want to do what I'm expecting when I stick it anywhere 
> else.  That makes absolutely no sense to me.  How/what am I not understanding?

It should work almost anywhere.

>
>  I'd greatly appreciate any guidance/ pointers/ references to anything 
> that'll help me accomplish this.
>
>  Regards,
>
>
>  - Dan
>
>
>  __________________________________________________
>  Do You Yahoo!?
>  Tired of spam?  Yahoo! Mail has the best spam protection around
>  http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to