Unable to log the response

I’m trying to log the response using this code, but unable to log. In this code, ‘city_code’ is the variable I used from CSV.

console.log(pm.iterationData.set(‘city_code’))
pm.test(“Status code is 200”, function () {
pm.response.to.have.status(200);
});

Data files are referenced by “data”.

Therefore the following should work, as long as your CSV file has a header called city_code (no quotes are needed).

console.log(data.city_code);

Hi, @mdjones thanks for your time. It’s not working for me.

Can you please post a screen shot of your CSV file (redacted as appropriate) and another of your code and console.log.

Can I just confirm that you are using the run collection to select the CSV file?

image

This is an example.

names.csv
image

Tests tab (note: case sensitive)
image

Collection Runner
image

Console Log (two iterations)
image