if(person.prefix != null)
vars.put("prefix",person.prefix);
else
vars.put("prefix","");
Should work.
Chaitanya M Bhatt
http://www.performancecompetence.com
On Tue, Dec 30, 2014 at 10:45 PM, SanderW <[email protected]>
wrote:
> Hi,
>
> I'm getting the following response from a server (the actual response
> contains almost 50 variables):
>
> /var s0={};var s1="John Allen";s0.firstnames=s1;var
> s2=null;s0.prefix=s2;var
> s3="Doe";s0.lastname=s3;
> DWREngine._handleResponse('97_1420006799508', s0);/
>
> I'm using BSF PostProcessor to put all the variables in JMeter variables
> with the following code:
>
> /var person = null;
>
> function dwrPrototype () {
> this._handleResponse = function(handle,myObject){
> person = myObject;
> };
> }
> var DWREngine = new dwrPrototype();
>
> (new Function(prev.getResponseDataAsString())())
>
> vars.put("firstnames",person.firstnames);
> vars.put("firstnames",person.prefix);
> vars.put("firstnames",person.lastname); /
>
> In the Results Tree I the following response data for a Debug Sampler:
> firstnames=John Allen
> prefix=null
> lastname=Doe
>
> If I use the variable prefix later on in a field, the request fails because
> it contains ${prefix} instead of null.
> I would rather have and empty string ("") filled in the field.
>
> How do I do this?
>
>
>
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/How-do-I-replacing-null-in-beanshell-by-empty-string-tp5721570.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>