Introduction #
If you are using BPA Platform 2018 or higher, you can easily create any delimited-separated file using the Format as Flat File tool — see How to Add a Format as Flat File Task Step. If you are using BPA Platform (formerly “TaskCentre”) version 4.7 or below, you must use the Format as Text tool.
You can use the Format as Text tool to easily create files with common separators or delimiters, such as commas (,
), pipes (|
), or double-quotes (""
). This article describes how to create a tab-separated file using the Format as Text tool.
Why Can’t I Use the TAB Key? #
The TAB key moves the cursor to the next tab stop. Simple enough, but tab stops are different lengths interpreted by the software. Moreover, if you use the TAB key in any BPA Platform tool, this is treated as a “move to next field” action rather than as forming part of the output.
Instead, we recommend using the VBScript function, VBTab
.
About the VBTab Function #
The VBTab
function inserts ASCII character 9 (a horizontal tab) where required.
This function is available in the Task Browser for use in any task step:
- Go to the Reference tab.
- Expand VB Script > Constants > String.
Creating a Tab Separated File #
- Add a Format as Text step to the relevant task.
- In the General tab, enable Use a Recordset and select the relevant recordset-generating task from the drop-down.
- Select whether to generate One document or a New document when the column changes (choose the relevant column).
- If a header row is required for your tab-separated file, create the first field heading in the Header pane.
- Immediately after the first heading, type {=.
- Drag the vbTab function from the Task Browser so that it is immediately after the =.
- Close the function with a curly bracket, }, so it looks like HEADING1{=vbTab}.
- Repeat until the header row is created.
- Build the contents of your tab-separated file in the Detail pane.
- Drag the first recordset column or variable into the Detail pane.
- Add the vbTab function immediately after, remembering to add {= and } to resolve the VBScript function.
- Repeat until the contents have been built.
- If a footer is required, build it in the Footer pane.
- This step can now be consumed by any Output tool.
Alternative Method to Creating the Contents #
If your file contents are VBScript heavy (as the example above), you can merge all the VBScript statements into one, though this is a manual process which requires familiarity with VBScript:
Sample Output #
Were the above Format as Text step be saved to file (Save File), the following would be outputted: