Custom Column Headings

View some of the Frequently Asked Questions to our support staff. Included are some tips and tricks making this forum ideal for users getting started with GoAnywhere MFT. Note: Users can reply to existing topics but only our support staff can add new topics to this forum.
1 post Page 1 of 1

Support_Julie

User avatar
Support Specialist
Posts: 91
Joined: Thu Mar 05, 2009 3:49 pm
Location: Ashland, NE USA

Post by Support_Julie » Thu Feb 14, 2019 11:48 am
Question:
When doing an SQL query, the data is written out to a file. How do I configure the WRITE task so that custom column headings are written to the file (not the field name)?

Answer:
If you wish to specify a column heading other than the field name, then you need to specify the column heading in the SQL statement.
You can use the SQL Wizard in MFT to build the SQL. If you select “Custom Heading”, then it lets you add whatever you want for the field heading.

Otherwise, you can modify your SQL statement by adding the AS “custom heading” syntax to the SQL for each field.
Then you can use that Output variable in a subsequent Write task (CSV below) and specify "includeHeadings="true".

For Example:
SELECT
field1 AS “Custom heading 1”,
field2 AS “Custom heading 2”
FROM
DatabaseTableName


Project example:
Code: Select all
<project name="CustomHeadingsExample" mainModule="Main" version="2.0" logLevel="verbose">
	<module name="Main">
		<sql resourceId="MyDatabaseServer" version="1.0">
			<query outputVariable="data">
				<statement>
                                      SELECT 
                                           field1 AS “Custom heading 1”,   
                                           field2 AS “Custom heading 2”
                                     FROM 
                                          DatabaseTableName
                               </statement>
		    </query>
		</sql>
		<writeCSV inputRowSetVariable="${data}" outputFile="\temp\MyFile.csv" includeHeadings="true" version="1.0" />
	</module>
</project>
Julie Rosenbaum
Sr Support Analyst
e. [email protected]
p. 1.800.949.4696
w. HelpSystems.com
1 post Page 1 of 1