Ask a Question

Get NULL from Excel spreadsheet used for Datasource in SoapUI NG Pro?

dief123
Occasional Contributor

Get NULL from Excel spreadsheet used for Datasource in SoapUI NG Pro?

We have operational JSON and several fields are set to variables to be populated with the values from an Excel spreadsheet

used as a Datasource.

 

My question is how do I enter a NULL into the Excel spreadsheet so SoapUI NG Pro inserts that

value into my JSON without quotes?

 

My JSON has "field": "${DataSource#fieldvalue}",

 

My desired outcome after the DataSource is read in and populates my JSON is:

 

"field": NULL,   (not "field": "NULL",)

 

How to I enter the NULL into the Excel spreadsheet so this works?  I have tried many variations and nothing works.

 

I also need it do work the same way if I enter numerical values, i.e. "field": 12345,  (not "field":"12345",)

 

 

 

9 REPLIES 9
nmrao
Community Hero

Re: Get NULL from Excel spreadsheet used for Datasource in SoapUI NG Pro?

dief123
Occasional Contributor

Re: Get NULL from Excel spreadsheet used for Datasource in SoapUI NG Pro?

I posted a new thread because the previous one was getting nowhere.  I want to start a fresh new thread, not refer to the previous one.

 

How hard is it to get this very simple question answered? 

 

Is there a problem with SoapUI NG Pro - does the Datasource feed simply not work correctly???

JustinM89
Contributor

Re: Get NULL from Excel spreadsheet used for Datasource in SoapUI NG Pro?

Your question was answered in the previous thread, you need to use a Groovy script.

dief123
Occasional Contributor

Re: Get NULL from Excel spreadsheet used for Datasource in SoapUI NG Pro?

We do not want to use a groovy script and we have no groovy scripts developed for any reason.

 

We simply want to use a Spreadsheet as a Datasource and have the tool read the data into the JSON like

it is designed to do.

JustinM89
Contributor

Re: Get NULL from Excel spreadsheet used for Datasource in SoapUI NG Pro?

It is doing what it's designed to do. When you type "Null" in your Excel sheet, it's treating it as a string; it has no way of knowing you literally want Null. Now you have a reason to develop a Groovy script.

 

dief123
Occasional Contributor

Re: Get NULL from Excel spreadsheet used for Datasource in SoapUI NG Pro?

And how would you specify numerical values?  i.e. 12345 in the Excel spreadsheet such that

it populates the JSON with "field": 12345,

 

 

nmrao
Community Hero

Re: Get NULL from Excel spreadsheet used for Datasource in SoapUI NG Pro?

It is recommended - no cross posts. For now answering, for further questsions if any, please use new topic.
1. It is possible to choose data types in excel for each column.

2. Since you know the data type of json element is a number, avoid double quotes while specifying value.
For eg:
{
"age" : ${DataSource#age}
}



Regards,
Rao.
dief123
Occasional Contributor

Re: Get NULL from Excel spreadsheet used for Datasource in SoapUI NG Pro?

I tried that with no quotes and the JSON service call failed because of syntax errors.

nmrao
Community Hero

Re: Get NULL from Excel spreadsheet used for Datasource in SoapUI NG Pro?

But, has the number data type has been selected for that column in the excel and data saved before using it in Ready!API?


Regards,
Rao.
cancel
Showing results for 
Search instead for 
Did you mean: