Selecting to a text file

Overview

The [highlight txt=’select to Excel’] instruction allows a user to select data (via a query) in a Access Table and copy the selected data to a text file.

[message type=”warning”]For the purposes of this article we are going to use two simple and fictitious files. They have already been uploaded into a data step. You will want to replace these files with those of your own.[/message]

Before we get started

Please further create a ‘Manipulate a file’ or ‘Multiple file manipulations’ action step so that you can add and use instructions.

The source file that we are going to use contains the following data:

The target file that we are going to use is a ‘blank’ text (.txt) file. However, this file is not empty. It contains the words “This file will be used as the Target file”. The reason for this is that an empty text file will have a size of 0KB in SolveXia. A file of 0KB cannot be processed. The words were typed into the file so in order to bring its size above 0KB. Please note this instruction will clear the target text file every time it runs. Therefore, any pre-populated text will be cleared and will not be exist after the instruction is run. All that the target file will contain is what was intended to be imported from the text file.

Steps

1. Create an ‘Export to text file’ instruction.

2. Link the file named “Source” as the source file.

3. Open the Expert SQL Editor by clicking the ‘View/Edit SQL’ hyperlink.

4. In the Expert SQL Editor, you can write the query you want to run, as well as specify the Table you want to run the query on. Here, we will write a query which selects the ‘Carrier_Name’ field from the Table. The Editor should be populated with “SELECT” (with a white-space after it) by default. Type “[Table1].[Carrier_Name] FROM [Table1]” immediately after the white-space.

5. Save the query.

6. The rule for the character to be used to be delimit data in the text file should be set to ‘Comma’ by default.

7. Tick the box for the ‘Export column headings to the target?’ rule.

8. The rule for how date data is formatted in the Excel file should be set to ‘dd/MM/yyyy, None’ by default.

9. Link the file named “Target” as the target file.

10. Save and run the step.

11. After the step finishes running, download and open the target file. It will resemble the image below:

Recent Posts

Leave a Comment