We are using the javascript version for Arcgis 10.1 "Public Notification" template with our data and would like filter out "null" or empty data responses when it gathers the field data for the Avery labels or the CSV output file. I attempted to use some code and it either gives me an "undefined" error in a dialog box when I select avery label or "strCsvParam.filter is not a function" error in a dialog box when I select CSV format.
The main problem is that we have parcels that have "Owner Name", "Address1", "Address2", "Address3", "City", "State", "Zip" for fields. Not all of the parcels with have any data in "Address2" or "Address3" which leaves blank lines between "Address1" and "City, State, Zip" on the avery label.
I just want to remove the null or empty data from the array.
This is the code that I have tried to remove the empty fields:
If you're using AMD style, you'll want to modify Jason's sample to use dojo/_base/array.filter() instead of dojo.filter.
If you don't need to support IE versions older than 9 then you should use the built in JavaScript Array filter method instead of either of the dojo methods. (This is for performance reasons.)