Maniram
Maniram

Reputation: 179

JMeter JDBC Call returns the value as parameter name if the value received from DB is null

I am using a JDBC PreProcessor in JMeter to fetch a value from the DB before firing a SOAP call which needs to be enriched with that information.

I have assigned a variable XYZ to fetch the value returned from DB. If there is a value returned from DB, i am able to get that value using ${XYZ_1} successfully, however if the value returned from DB is nothing (null) (as seen in DB), the value returned using ${XYZ_1} is shown as ${XYZ_1}.

I am using this variable in Sampler as <Location>${XYZ_1}</Location>

Ex: If DB returns value as 'California', i get it as <Location>California</Location>

If DB returns value as nothing (null), the value looks like <Location>${XYZ_1}</Location>.

Now my issue here is, if DB returns the value as nothing (null), i want the value to be set as nothing. So it should like like below

<Location></Location>

Any suggestions on this?

Upvotes: 1

Views: 864

Answers (1)

UBIK LOAD PACK
UBIK LOAD PACK

Reputation: 34566

You could modify your SQL so that instead of null it returns empty.

Another option is to put a JSR223 Post Processor + Groovy (or Beanshell Post Processor) after your JDBC Post Processor that would test the variable and if null put empty String instead.

Upvotes: 1

Related Questions