Ascii Export Custom Filters


The purpose of Custom Character Filters is to allow the user complete control over how specified characters are treated when they are exported. Custom filters only apply to character fields where quotes, field separators and record separators may exist in the data itself. The default behaviour, if no filters are defined, is to strip off field and record separators only. Quotes are left alone, as it is assumed the program that consumes the data you are exporting to ignores quotes (unless the 'Quote Character Fields' option is used). For our first example, we will edit the customer table in AlphaSports to include various quote characters, and a comma inside the data (see the 'Company' field).


When you click on the 'properties' for the Export Ascii builder, you will notice a new 'Character Filters' list on the right of the usual Export settings. We are going to start by clicking the 'Add Rule' button. Then click the 'Add Character' button to add the double quote character. Click a second time to add the single quote character.


Now select the 'Replace with Text' option and type a back quote, and then hit the 'OK' button to commit the new rule. This rule will replace double quote and single quote characters with back quote characters.


Now we add a rule to strip commas out of data. To do this we 'Add Rule' again and select 'Add Character', this time selecting the comma. Then we hit 'OK' and 'OK' again at the Export Characters dialog to commit the rule.


When we run this export against our modified data, we see that the filter rule replaced the double quote and single quote with a back quote, and that the comma has been removed.


Filter using expression

If you want to do something other than replacement when specific characters are encounted, there is also a 'Process Using Expression' option. To use this, you specify the characters you want to invoke the rule for, the same way you defined the rule for quote replacement. Only this time, we add comma to the list. For this example, we want to conditionally quote text that includes any quote characters or commas, while leaving the rest of the text unquoted.


As you can see, when we run the second export on the same data, the fields that contain problem characters are quoted, wherease all other fields are left alone.



Desktop Applications Only

See Also