# Skip array element if variable blank\\null in CSV

**URL:** <https://community.postman.com/t/skip-array-element-if-variable-blank-null-in-csv/1163>\
**Category:** Help Hub\
**Created:** [March 6, 2018, 9:03pm UTC](https://community.postman.com/t/skip-array-element-if-variable-blank-null-in-csv/1163 "2018-03-06T21:03:15Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![dhoyt](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/dhoyt/32/238_2.png) [@dhoyt](https://community.postman.com/u/dhoyt)\
**Post date:** [March 7, 2018, 6:32pm UTC](https://community.postman.com/t/skip-array-element-if-variable-blank-null-in-csv/1163/2 "2018-03-07T18:32:10Z")

</div>

@nmasson-pbc

I haven’t actually tried this but in theory it should work …

For the POST body …

```javascript
"Array1": [{{postVars}}]

```

I don’t know what your actual CSV vars are but this is what would go into “Pre-req” …

```javascript
var var_1 = pm.iterationData.get("var1");
var var_2 = pm.iterationData.get("var2");
var var_3 = pm.iterationData.get("var3");

var postVars = '{ "Id": "' + var1 + '" }';

if ( var_2 !== '' ) {
    postVars = postVars + ',{ "Id": "' + var_2 + '" }';
}
if ( var_3 !== '' ) {
    postVars = postVars + ',{ "Id": "' + var_3 + '" }';
}

```

Like I said above, I haven’t actually run this but you could try it and tweak it if needed.

---

_[View the full topic](https://community.postman.com/t/skip-array-element-if-variable-blank-null-in-csv/1163)._
