On occasion, fields may contain unwanted spaces before or after the relevant data. This may be due to applicant data entry errors, or inadvertent spacing in multiple choice options. If you are importing data into another system, you may need to remove these extra spaces. The JavaScript configuration below allows you to strip the leading or following blank spaces, leaving you with a usable export file.
To complete this configuration, you'll need to add a Calculated Field to a Tabular/Spreadsheet Export. You can do this while configuring your Export by dragging a Calculated Field into the Columns to export.
After dropping in the Calculated Field, use the JavaScript Expressions option by dropping the code listed below into the Expression field. Then, update the code to indicate which field you are exporting.
After following the steps above, use the following code in your JavaScript Expression. (Use the view source icon at the top right to copy the code snippet.)
{ // USER INPUT SECTION let field = enter.fieldname.here; // DO NOT EDIT if(typeof field != "undefined" && field != null){ return field.trim(); }else{ return ""; } }
Once you've added this code into your JavaScript expression, you'll need to modify it in the following ways: