Ignore Variable if Null on CSV

variables
#1

Hi, I’m new to Postman and setting up a basic Data driven Soap Request where it reads Address from a CSV file. In some cases I have {{DISTRICT}} and Null on the CSV but Postman is pulling in the Variable name when this record is left blank. Is there any way to pass this a Null if Null on the CSV?

Thanks in advance.

#2

Hey @jitesh.sevani

Welcome to the community :wave:

Are you to expand on this some more, please?

Could you include a sample of the data file and any relevant images that would help people to understand the issue you’re facing.

#3

Hi, Sure.

Here is the XML:

                    <asm:BuildingNo>{{BUILDINGNO}}</asm:BuildingNo>
                    <asm:HouseName>{{HOUSENAME}}</asm:HouseName>
                    <asm:HouseNumber>{{HOUSENUMBER}}</asm:HouseNumber>
                    <asm:StreetLine1>{{STREETLINE1}}</asm:StreetLine1>
                    <asm:StreetLine2>{{STREETLINE2}}</asm:StreetLine2>
                    **<asm:District>{{DISTRICT}}</asm:District>**      
                    <asm:Town>{{TOWN}}</asm:Town>
                    <asm:Country>{{COUNTRY}}</asm:Country>
                    <asm:PostCd>{{POSTCD}}</asm:PostCd>

Here is the CSV file:

What I end up with is this:

                    <asm:BuildingNo>1</asm:BuildingNo>
                    <asm:HouseName>MILLHOUSE</asm:HouseName>
                    <asm:HouseNumber>3</asm:HouseNumber>
                    <asm:StreetLine1>Sandy Road</asm:StreetLine1>
                    <asm:StreetLine2>Greenwich</asm:StreetLine2>
                    <asm:District>{{DISTRICT}}</asm:District>
                    <asm:Town>London</asm:Town>
                    <asm:Country>UK</asm:Country>
                    <asm:PostCd>SE19 8BT</asm:PostCd>
#4

It’s taking that {{DISTRICT}} value from the POST data and not the file, as it doesn’t know what that value is, within the data file. You would probably be seeing the same for the {{TOWN}} placeholder on the 2nd iteration.

That being said, I’m not sure why that wouldn’t be coming through as null from the file.

Are you able to post an image of the Preview, from the Collection runner?

As a potential workaround, you could try and populate those blank values with null and see what happens?

I’m not sure about the implementation of the service, would it handle a null value?

#5

I have put ‘null’ in the blank fields and all it does is pull the text though as ‘null’ and not blank. It’s strange as I would expect it to ignore any columns that are blank.